bugGNU Octave - Bugs: bug #53004, Variable editor: segfault with...

 
 

bug #53004: Variable editor: segfault with very large arrays

Submitter:  Rik <rik5>
Submitted:  Mon 29 Jan 2018 09:40:07 PM UTC
   
 
Category:  GUI Severity:  4 - Important
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 02 Feb 2018 06:02:44 AM UTC, comment #5: 

I just re-checked and I no longer get segfaults.  I think the extensive re-coding of the Variable Editor to get rid of Qvector may have helped here.  Closing report.

Rik <rik5>
Group administrator
Wed 31 Jan 2018 12:52:31 AM UTC, comment #4: 

I verified that the preliminary patch in bug #50198 fixes the issue there.  We could use the same approach with try/catch blocks and rethrowing the exception, unless there is something simpler.

Rik <rik5>
Group administrator
Tue 30 Jan 2018 11:06:19 PM UTC, comment #3: 

I rewrote the diff and attached it in bug #50198

Basically I made use of octave_link::post_event to rethrow the exception from the gui thread to the interpreter thread where it can be safely caught. The exception_ptr is thread safe and guaranteed to remain valid until no reference to it exist anymore.

Pantxo Diribarne <pantxo>
Group Member
Tue 30 Jan 2018 10:22:52 PM UTC, comment #2: 

At least the try/catch approach works for bug #50198 but it seams I did not attach the diff and I can't find the file right now.

Pantxo Diribarne <pantxo>
Group Member
Tue 30 Jan 2018 07:34:22 PM UTC, comment #1: 

This is possibly more of a generic problem in the GUI.  We may need some try/catch blocks there.  The ones in the interpreter thread won't do any good since I don't think you can throw exceptions across threads.  So currently I think any function in the GUI that might call Octave's error() function is a potential crash.

John W. Eaton <jwe>
Group administrator
Mon 29 Jan 2018 09:40:07 PM UTC, original submission:  

When attempting to display very large arrays with the variable editor I encounter a segfault.

Sample code:


x = rand (5000);
openvar x


The backtrace is:


#0  0x00007fcc6fb04428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#1  0x00007fcc6fb0602a in __GI_abort () at abort.c:89
#2  0x00007fcc7013e84d in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007fcc7013c6b6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007fcc7013c701 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007fcc7013c969 in __cxa_rethrow () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007fcc72edd92c in QVector<variable_editor_model::impl::cell>::reallocData (this=0x1aaa0b0, asize=25000000, aalloc=25000000, options=...)
    at /usr/include/x86_64-linux-gnu/qt5/QtCore/qvector.h:572
#7  0x00007fcc72edcf7b in QVector<variable_editor_model::impl::cell>::resize (this=0x1aaa0b0, asize=25000000) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qvector.h:412
#8  0x00007fcc72edca42 in variable_editor_model::impl::reset (this=0x1aaa080, val=...) at libgui/src/variable-editor-model.cc:246
#9  0x00007fcc72ed8fa3 in variable_editor_model::variable_editor_model (this=0x1aa9300, expr=..., val=..., label=0x1a97440, parent=0x1a96090)
    at libgui/src/variable-editor-model.cc:333
#10 0x00007fcc72ecd412 in variable_editor::edit_variable (this=0x14e19a0, name=..., val=...) at libgui/src/variable-editor.cc:169
#11 0x00007fcc72e4f4ec in main_window::edit_variable (this=0x7fffa8e1c360, expr=..., val=...) at libgui/src/main-window.cc:1741
#12 0x00007fcc72ee9df6 in main_window::qt_static_metacall (_o=0x7fffa8e1c360, _c=QMetaObject::InvokeMetaMethod, _id=103, _a=0x7fcc303d8f90) at libgui/src/moc-main-window.cc:748
#13 0x00007fcc6ec2c719 in QObject::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#14 0x00007fcc6f57a04b in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#15 0x00007fcc6f6924bb in QMainWindow::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#16 0x00007fcc6f534afc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#17 0x00007fcc6f53a036 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#18 0x00007fcc6ebff2a8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#19 0x00007fcc6ec0116a in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#20 0x00007fcc6ec53f53 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#21 0x00007fcc68517197 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#22 0x00007fcc685173f0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#23 0x00007fcc6851749c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#24 0x00007fcc6ec5435f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#25 0x00007fcc6ebfcffa in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#26 0x00007fcc6ec056bc in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#27 0x00007fcc72e63cc7 in octave::gui_application::execute (this=0x7fffa8e1c6d0) at libgui/src/octave-gui.cc:248
#28 0x000000000040188d in main (argc=9, argv=0x7fffa8e1c9e8) at src/main-gui.cc:104


The supposition is that the realloc fails and throws an exception, and that due to issues with threading, the wrong thread without an exception handler receives the exception which then calls std::terminate.


Rik <rik5>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Submitted the item)
  • -email is unavailable- added by rik5
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-02-02 rik5 StatusNone Fixed
        Open/ClosedOpen Closed
    2018-01-29 rik5 Carbon-Copy- Added jwe

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code