Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save. Close. Reopen. crashes UV-CDAT #230

Closed
rexissimus opened this issue Jul 10, 2013 · 9 comments
Closed

Save. Close. Reopen. crashes UV-CDAT #230

rexissimus opened this issue Jul 10, 2013 · 9 comments
Assignees

Comments

@rexissimus
Copy link
Member

Create an ASD + clt plot. Save. Close. Reopen. UV-CDAT will crash. This happens on Linux and Mac. Below is the stack trace on mac.

Process:         Python [3863]
Path:            /usr/local/uvcdat/1.3.1/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
Identifier:      org.python.python
Version:         2.7.3 (2.7.3)
Code Type:       X86-64 (Native)
Parent Process:  sh [3862]

Date/Time:       2013-07-10 16:56:17.030 +0200
OS Version:      Mac OS X 10.7.5 (11G63)
Report Version:  9

Interval Since Last Report:          32778 sec
Crashes Since Last Report:           1
Per-App Interval Since Last Report:  15356 sec
Per-App Crashes Since Last Report:   1
Anonymous UUID:                      2A65B475-985D-4354-901E-11CB43C71578

Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: 0x000000000000000d, 0x0000000000000000

VM Regions Near 0:
--> 
    __TEXT                 0000000100000000-0000000100001000 [    4K] r-x/rwx SM=COW  /usr/local/uvcdat/1.3.1/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python

Application Specific Information:
objc[3863]: garbage collection is OFF

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   QtGui                           0x0000000101c880e0 QWidgetPrivate::setUpdatesEnabled_helper(bool) + 112
1   QtGui                           0x0000000101c881cf QWidgetPrivate::setUpdatesEnabled_helper(bool) + 351
2   QtGui                           0x0000000101c881cf QWidgetPrivate::setUpdatesEnabled_helper(bool) + 351
3   QtGui                           0x0000000101c881cf QWidgetPrivate::setUpdatesEnabled_helper(bool) + 351
4   QtGui                           0x0000000101c881cf QWidgetPrivate::setUpdatesEnabled_helper(bool) + 351
5   QtGui                           0x0000000101c881cf QWidgetPrivate::setUpdatesEnabled_helper(bool) + 351
6   QtGui                           0x0000000101c881cf QWidgetPrivate::setUpdatesEnabled_helper(bool) + 351
7   QtGui                           0x0000000101c881cf QWidgetPrivate::setUpdatesEnabled_helper(bool) + 351
8   QtGui                           0x0000000101c881cf QWidgetPrivate::setUpdatesEnabled_helper(bool) + 351
9   QtGui                           0x0000000101c881cf QWidgetPrivate::setUpdatesEnabled_helper(bool) + 351
10  QtGui                           0x0000000101c881cf QWidgetPrivate::setUpdatesEnabled_helper(bool) + 351
11  QtGui                           0x0000000101c881cf QWidgetPrivate::setUpdatesEnabled_helper(bool) + 351
12  QtGui                           0x0000000101c6ea7a QStackedLayout::setCurrentIndex(int) + 378
13  QtGui.so                        0x00000001013b128a meth_QStackedWidget_setCurrentWidget + 122
14  org.python.python               0x00000001000c04bd PyEval_EvalFrameEx + 21437
15  org.python.python               0x00000001000c1bd5 PyEval_EvalFrameEx + 27349
16  org.python.python               0x00000001000c24c6 PyEval_EvalCodeEx + 2134
17  org.python.python               0x000000010003cc40 function_call + 176
18  org.python.python               0x000000010000b6e2 PyObject_Call + 98
19  org.python.python               0x000000010001dcdd instancemethod_call + 365
20  org.python.python               0x000000010000b6e2 PyObject_Call + 98
21  org.python.python               0x00000001000b9e47 PyEval_CallObjectWithKeywords + 87
22  sip.so                          0x0000000102f0d64c sip_api_invoke_slot + 423
23  QtCore.so                       0x0000000103b2327f PyQtProxy::invokeSlot(qpycore_slot const&, void**) + 207
24  QtCore.so                       0x0000000103b233c3 PyQtProxy::unislot(void**) + 227
25  QtCore.so                       0x0000000103b23487 PyQtProxy::qt_metacall(QMetaObject::Call, int, void**) + 119
26  QtCore                          0x00000001029e5436 QMetaObject::activate(QObject*, QMetaObject const*, int, void**) + 2150
27  QtGui                           0x00000001021b451c QTreeWidget::itemClicked(QTreeWidgetItem*, int) + 60
28  QtCore                          0x00000001029e51ee QMetaObject::activate(QObject*, QMetaObject const*, int, void**) + 1566
29  QtGui                           0x0000000102131519 QAbstractItemView::clicked(QModelIndex const&) + 41
30  QtGui                           0x000000010213f752 QAbstractItemView::mouseReleaseEvent(QMouseEvent*) + 290
31  QtGui.so                        0x0000000101303c2b sipQTreeWidget::mouseReleaseEvent(QMouseEvent*) + 107
32  QtGui                           0x0000000101c8f355 QWidget::event(QEvent*) + 2421
33  QtGui                           0x000000010201e8ec QFrame::event(QEvent*) + 44
34  QtGui                           0x00000001020aabc7 QAbstractScrollArea::viewportEvent(QEvent*) + 23
35  QtGui                           0x000000010213fccb QAbstractItemView::viewportEvent(QEvent*) + 427
36  QtGui                           0x000000010217ec0b QTreeView::viewportEvent(QEvent*) + 299
37  QtGui.so                        0x00000001013035db sipQTreeWidget::viewportEvent(QEvent*) + 123
38  QtGui                           0x00000001020acf50 QAbstractScrollAreaFilter::eventFilter(QObject*, QEvent*) + 48
39  QtCore                          0x00000001029cccb7 QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) + 151
40  QtGui                           0x0000000101c329be QApplicationPrivate::notify_helper(QObject*, QEvent*) + 142
41  QtGui                           0x0000000101c39590 QApplication::notify(QObject*, QEvent*) + 2384
42  QtGui.so                        0x00000001015eb74e sipQApplication::notify(QObject*, QEvent*) + 142
43  QtCore                          0x00000001029cd20c QCoreApplication::notifyInternal(QObject*, QEvent*) + 124
44  QtGui                           0x0000000101c36fdd QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) + 333
45  QtGui                           0x0000000101be6acb qt_mac_handleMouseEvent(NSEvent*, QEvent::Type, Qt::MouseButton, QWidget*, bool) + 763
46  com.apple.AppKit                0x00007fff8e590d5e -[NSWindow sendEvent:] + 6504
47  QtGui                           0x0000000101bdbbb7 -[QCocoaWindow sendEvent:] + 87
48  com.apple.AppKit                0x00007fff8e52a3a5 -[NSApplication sendEvent:] + 5593
49  QtGui                           0x0000000101be0bf4 -[QNSApplication sendEvent:] + 84
50  com.apple.AppKit                0x00007fff8e4c0a0e -[NSApplication run] + 555
51  QtGui                           0x0000000101beba80 QEventDispatcherMac::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 1824
52  QtCore                          0x00000001029cc114 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 68
53  QtCore                          0x00000001029cc4c4 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 324
54  QtCore                          0x00000001029cebac QCoreApplication::exec() + 188
55  QtGui.so                        0x00000001015ec44c meth_QApplication_exec_ + 92
56  org.python.python               0x00000001000c04bd PyEval_EvalFrameEx + 21437
57  org.python.python               0x00000001000c24c6 PyEval_EvalCodeEx + 2134
58  org.python.python               0x00000001000c25e6 PyEval_EvalCode + 54
59  org.python.python               0x00000001000e715e PyRun_FileExFlags + 174
60  org.python.python               0x00000001000e7419 PyRun_SimpleFileExFlags + 489
61  org.python.python               0x00000001000fe34d Py_Main + 3085
62  org.python.python               0x0000000100000f14 0x100000000 + 3860
@benbu
Copy link
Member

benbu commented Jul 10, 2013

I wonder if this is related to #213 and the QStackedWidget::setCurrentWidget: widget 0x1417797d0 not contained in stack message. Lines 12 and 13 of the above crash report are

12  QtGui                           0x0000000101c6ea7a QStackedLayout::setCurrentIndex(int) + 378
13  QtGui.so                        0x00000001013b128a meth_QStackedWidget_setCurrentWidget + 122

If I start uvcdat fresh and load a saved project before doing anything else, I get that message on the console (this might go to the uvcdatsession.log as well).

@rexissimus
Copy link
Member Author

I don't think it is related, because it happens before and after I fixed #213. And the error on Linux does not mention setCurrentWidget. But it may have something to do with invalid or dangling references. VisTrails may be reloading the same Vistrail object because of the way Locator caching works.

@ghost ghost assigned benbu Jul 15, 2013
@rexissimus
Copy link
Member Author

Clearing the VisTrails cache avoids the problem. But then I get the error below instead. What is QAbstractUriResolver and why does the addWidget call fail? Also, the error seems related to VCSQtManager. Perhaps the cache and reloading the vistrail causes it to get out of sync?

{{{
Traceback (most recent call last):
File "/Users/tommy/git/uv-cdat/source/vistrails/vistrails/core/modules/vistrails_module.py", line 328, in update
self.compute()
File "/Users/tommy/git/uv-cdat/source/vistrails/vistrails/packages/uvcdat_cdms/init.py", line 941, in compute
self.cellWidget = self.displayAndWait(QCDATWidget, input_ports)
File "/Users/tommy/git/uv-cdat/source/vistrails/vistrails/packages/spreadsheet/basic_widgets.py", line 248, in displayAndWait
return spreadsheetWindow.displayCellEvent(e)
File "/Users/tommy/git/uv-cdat/source/vistrails/vistrails/packages/spreadsheet/spreadsheet_window.py", line 492, in displayCellEvent
sheet.setCellByType(row, col, e.cellType, e.inputPorts)
File "/Users/tommy/git/uv-cdat/source/vistrails/vistrails/packages/spreadsheet/spreadsheet_tab.py", line 319, in setCellByType
newCell.updateContents(inputPorts)
File "/Users/tommy/git/uv-cdat/source/vistrails/vistrails/packages/uvcdat_cdms/init.py", line 1011, in updateContents
self.layout().addWidget(self.window)
TypeError: QBoxLayout.addWidget(QWidget, int stretch=0, Qt.Alignment alignment=0): argument 1 has unexpected type 'QAbstractUriResolver'
}}}

@benbu
Copy link
Member

benbu commented Aug 14, 2013

It seems to be related to the VCSQtManager. This only happens with vcs projects, DV3D and others work fine. I traced it to this line vistrails/packages/uvcdat_cdms/init.py:1070

self.window = VCSQtManager.window(self.windowId)

produces this (partial) segfault dump

[macbookpro-5f35:19838] *** Process received signal ***
[macbookpro-5f35:19838] Signal: Bus error: 10 (10)
[macbookpro-5f35:19838] Signal code: Non-existant physical address (2)
[macbookpro-5f35:19838] Failing at address: 0x7fff79af2618
[macbookpro-5f35:19838] [ 0] 2   libsystem_c.dylib                   0x00007fff8b60594a _sigtramp + 26
[macbookpro-5f35:19838] [ 1] 3   ???                                 0x000000010075b320 0x0 + 4302680864
[macbookpro-5f35:19838] [ 2] 4   sip.so                              0x0000000101d9e703 convertPass + 146
[macbookpro-5f35:19838] [ 3] 5   sip.so                              0x0000000101d9e7dc sip_api_convert_from_type + 98
[macbookpro-5f35:19838] [ 4] 6   cdatguiwrap.so                      0x0000000117c5b153 meth_VCSQtManager_window + 115

The segfault occurs while trying to step into that function, almost as if it's unable to access the VCSQtManager class

It appears that sometimes this function succeeds, but returns some QAbstractUriResolver, which causes the exception Tommy was seeing, which is then followed by this segfault dump

[macbookpro-5f35:19882] *** Process received signal ***
[macbookpro-5f35:19882] Signal: Segmentation fault: 11 (11)
[macbookpro-5f35:19882] Signal code: Address not mapped (1)
[macbookpro-5f35:19882] Failing at address: 0x10
[macbookpro-5f35:19882] [ 0] 2   libsystem_c.dylib                   0x00007fff8b60594a _sigtramp + 26
[macbookpro-5f35:19882] [ 1] 3   ???                                 0x0000000000000003 0x0 + 3
[macbookpro-5f35:19882] [ 2] 4   QtGui                               0x0000000104a95a36 _ZN19QApplicationPrivate18dispatchEnterLeaveEP7QWidgetS1_ + 1030
[macbookpro-5f35:19882] [ 3] 5   QtGui                               0x0000000104a2072e _ZN19QApplicationPrivate14leaveModal_sysEP7QWidget + 206
[macbookpro-5f35:19882] [ 4] 6   QtGui                               0x0000000104a94d47 _ZN19QApplicationPrivate10leaveModalEP7QWidget + 359
[macbookpro-5f35:19882] [ 5] 7   QtGui                               0x0000000104ae2f5d _ZN14QWidgetPrivate11hide_helperEv + 493
[macbookpro-5f35:19882] [ 6] 8   QtGui                               0x0000000104aeaf79 _ZN7QWidget10setVisibleEb + 1145
[macbookpro-5f35:19882] [ 7] 9   QtGui                               0x0000000104f3a825 _ZN7QDialog10setVisibleEb + 325
[macbookpro-5f35:19882] [ 8] 10  QtGui.so                            0x000000010424f18c _ZN18sipQProgressDialog10setVisibleEb + 108
[macbookpro-5f35:19882] [ 9] 11  QtGui                               0x0000000104f5f9cc _ZN15QProgressDialog5resetEv + 588
[macbookpro-5f35:19882] [10] 12  QtGui                               0x0000000104f60758 _ZN15QProgressDialog8setValueEi + 328
[macbookpro-5f35:19882] [11] 13  QtGui.so                            0x000000010424c38d meth_QProgressDialog_setValue + 109

My best guess is that the VCSQtManager address space is being deleted when a project is closed, and sometimes gets replaced by this QAbstractUriResolver.

@doutriaux1 any idea how this might be happening? What all get's released when a project is closed?

@benbu
Copy link
Member

benbu commented Aug 14, 2013

This function at vistrails/packages/uvcdat_cdms/init.py:1140, part of the QCDATWidget class looks suspect:

    def deleteLater(self):
        """ deleteLater() -> None        
        Make sure to free render window resource when
        deallocating. Overriding PyQt deleteLater to free up
        resources
        """
        #we need to re-parent self.window or it will be deleted together with
        #this widget. The immediate parent is also deleted, so we will set to
        # parent of the parent widget
        if self.window is not None:
            self.window.setParent(self.parent().parent())
            self.window.setVisible(False)
        self.canvas = None
        self.window = None

        QCDATWidget.usedIndexes.remove(self.windowId)
        QCellWidget.deleteLater(self)    

Removing this function altogether (restoring base deleteLater functionality) gets passed the initial segfault, but causes a new segfault.

[macbookpro-5f35:20167] *** Process received signal ***
[macbookpro-5f35:20167] Signal: Segmentation fault: 11 (11)
[macbookpro-5f35:20167] Signal code: Address not mapped (1)
[macbookpro-5f35:20167] Failing at address: 0x1c
[macbookpro-5f35:20167] [ 0] 2   libsystem_c.dylib                   0x00007fff8b60594a _sigtramp + 26
[macbookpro-5f35:20167] [ 1] 3   Python                              0x0000000100052cd0 PyDict_GetItem + 112
[macbookpro-5f35:20167] [ 2] 4   _vcs.so                             0x0000000111bacbf9 templateRatio + 89
[macbookpro-5f35:20167] [ 3] 5   _vcs.so                             0x0000000111bae230 vcs_canvas_update + 624
[macbookpro-5f35:20167] [ 4] 6   _vcs.so                             0x0000000111b5b4e5 PyVCS_setGimember + 549
[macbookpro-5f35:20515] [ 5] 7   Python                              0x00000001000c04bd PyEval_EvalFrameEx + 21437
[macbookpro-5f35:20515] [ 6] 8   Python                              0x00000001000c1bd5 PyEval_EvalFrameEx + 27349
[macbookpro-5f35:20515] [ 7] 9   Python                              0x00000001000c24c6 PyEval_EvalCodeEx + 2134
[macbookpro-5f35:20515] [ 8] 10  Python                              0x000000010003cc40 function_call + 176
[macbookpro-5f35:20515] [ 9] 11  Python                              0x000000010000b6e2 PyObject_Call + 98
[macbookpro-5f35:20515] [10] 12  Python                              0x000000010000ffd5 PyObject_CallFunction + 197
[macbookpro-5f35:20515] [11] 13  Python                              0x0000000100028fc3 property_descr_set + 51
[macbookpro-5f35:20515] [12] 14  Python                              0x0000000100059601 _PyObject_GenericSetAttrWithDict + 225
[macbookpro-5f35:20515] [13] 15  Python                              0x0000000100059b55 PyObject_SetAttr + 133
[macbookpro-5f35:20515] [14] 16  Python                              0x00000001000b5bac builtin_setattr + 76
[macbookpro-5f35:20515] [15] 17  Python                              0x00000001000c04bd PyEval_EvalFrameEx + 21437
[macbookpro-5f35:20515] [16] 18  Python                              0x00000001000c24c6 PyEval_EvalCodeEx + 2134
[macbookpro-5f35:20515] [17] 19  Python                              0x00000001000c0005 PyEval_EvalFrameEx + 20229
[macbookpro-5f35:20515] [18] 20  Python                              0x00000001000c1bd5 PyEval_EvalFrameEx + 27349
[macbookpro-5f35:20515] [19] 21  Python                              0x00000001000c1bd5 PyEval_EvalFrameEx + 27349
[macbookpro-5f35:20515] [20] 22  Python                              0x00000001000c1bd5 PyEval_EvalFrameEx + 27349
[macbookpro-5f35:20515] [21] 23  Python                              0x00000001000c1bd5 PyEval_EvalFrameEx + 27349
[macbookpro-5f35:20515] [22] 24  Python                              0x00000001000c1bd5 PyEval_EvalFrameEx + 27349
[macbookpro-5f35:20515] [23] 25  Python                              0x00000001000c24c6 PyEval_EvalCodeEx + 2134
[macbookpro-5f35:20515] [24] 26  Python                              0x000000010003cc40 function_call + 176
[macbookpro-5f35:20515] [25] 27  Python                              0x000000010000b6e2 PyObject_Call + 98
[macbookpro-5f35:20515] [26] 28  Python                              0x00000001000bd0ab PyEval_EvalFrameEx + 8107
[macbookpro-5f35:20515] [27] 29  Python                              0x00000001000c24c6 PyEval_EvalCodeEx + 2134
[macbookpro-5f35:20515] [28] 30  Python                              0x000000010003cc40 function_call + 176
[macbookpro-5f35:20515] [29] 31  Python                              0x000000010000b6e2 PyObject_Call + 98

I traced this to lines 1105 and 1109 which try to change attributes on the graphicsmethod.

            cgm = self.get_graphics_method(plot.plot_type, plot.graphics_method_name)
            if plot.graphics_method_name != 'default':
                for k in plot.gm_attributes:
                    if hasattr(plot,k):
                        if k in ['legend']:
                            setattr(cgm,k,eval(getattr(plot,k))) ################## SEGFAULT HERE
                        else:
                            if getattr(plot,k)!=getattr(cgm,k):
                                #print "Setting:",k,getattr(plot,k)
                                setattr(cgm,k,getattr(plot,k))  ##################### OR HERE
                        #print k, " = ", getattr(cgm,k)

@benbu
Copy link
Member

benbu commented Aug 14, 2013

I was able to get around the issue by setting the QCDATWidget's parent to the main window, and then reusing that widget if it had been saved. It seems to be working. I will push the fix soon.

@benbu
Copy link
Member

benbu commented Aug 15, 2013

Fixed on branch uvcdat-230-save-close-open-crash and merged into uvcdat-next.

@benbu
Copy link
Member

benbu commented Aug 20, 2013

A new high level gui test has been added for this on these branches

VisTrails: uvcdat-246-gui-ctests
uvcdat-devel: 244-gui-ctests

They have been merged into uvcdat-next and devel-master respectively.

@aashish24
Copy link
Contributor

Worked for me, however found another problem. Will file a new bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants