[PyQt] assertion failure in sip
Erik Janssens
Erik.Janssens at conceptive.be
Tue Sep 20 20:23:21 BST 2011
I've tested it and it still segfaults at the same line.
Adding the GIL lock also causes a deadlock in one of
my pyqt unit tests : test_queued_connection_after_delete
This is a bit strange, because this is the test I wrote
to 'prove' another issue, but I have been unable to
create segfaults with this test.
If there is more debugging stuff I can try, please
let me know
On Sat, Sep 17, 2011 at 2:46 PM, Phil Thompson
<phil at riverbankcomputing.com> wrote:
> On Sat, 17 Sep 2011 04:51:42 +0100, Phil Thompson
> <phil at riverbankcomputing.com> wrote:
>> On Fri, 16 Sep 2011 22:28:24 +0200, Erik Janssens
>> <Erik.Janssens at conceptive.be> wrote:
>>> Hi,
>>>
>>> I'm seeing an assertion failure in sip, stacktrace
>>> attached.
>>>
>>> It happens consistently, but only after long stress
>>> tests of a large application.
>>>
>>> Any suggestions on what might be causing this
>>> failure, so I can try to isolate the case ?
>>
>> It looks like there might be a race condition when the Python object
>> wrapping the QWidget is being garbage collected and the QWidget itself
> is
>> still calling it's virtual methods.
>>
>> This is supposed to be taken care of by the "if (sipSelf == NULL)" test
>> earlier in the function. This test is done without the GIL. The pointer
>> being tested is set in dealloc_QWidget() (with the GIL).
>>
>> Therefore if the Python object is in the process of being garbage
>> collected but before dealloc_QWidget() gets a chance to reset the
> pointer,
>> and then QWidget::changeEvent() gets called then there might be a
> problem.
>>
>> The fix would be to do the test with the GIL but that requires a change
> to
>> the signature of sip_api_is_py_method() to pass a pointer to the pointer
>> being tested rather than the pointer itself.
>>
>> Watch this space...
>
> I've implemented the change in tonight's SIP snapshot (and current Hg).
>
> Let me know if it makes a difference.
>
> Phil
>
-------------- next part --------------
Program terminated with signal 11, Segmentation fault.
#0 0xb56623d6 in sip_api_is_py_method (gil=0xbfa65e08, pymc=0xc4ebde7 "", sipSelf=0x1057092c, cname=0x0, mname=0xb6c21297 "changeEvent") at siplib.c:7598
7598 assert(PyTuple_Check(mro));
(gdb)
(gdb)
(gdb)
(gdb)
(gdb)
(gdb) bt
#0 0xb56623d6 in sip_api_is_py_method (gil=0xbfa65e08, pymc=0xc4ebde7 "", sipSelf=0x1057092c, cname=0x0, mname=0xb6c21297 "changeEvent") at siplib.c:7598
#1 0xb6bf762c in sipQWidget::changeEvent (this=0xc4ebdb0, a0=0xc164920) at sipQtGuiQWidget.cpp:967
#2 0xb5b3a514 in QWidget::event (this=0xc4ebdb0, event=0xc164920) at kernel/qwidget.cpp:8529
#3 0xb6bf6425 in sipQWidget::event (this=0xc4ebdb0, a0=0xc164920) at sipQtGuiQWidget.cpp:473
#4 0xb5addb26 in QApplicationPrivate::notify_helper (this=0xa41a618, receiver=0xc4ebdb0, e=0xc164920) at kernel/qapplication.cpp:4462
#5 0xb5add865 in QApplication::notify (this=0xa260fd0, receiver=0xc4ebdb0, e=0xc164920) at kernel/qapplication.cpp:4427
#6 0xb6ba6af2 in sipQApplication::notify (this=0xa260fd0, a0=0xc4ebdb0, a1=0xc164920) at sipQtGuiQApplication.cpp:312
#7 0xb57eaf9e in QCoreApplication::notifyInternal (this=0xa260fd0, receiver=0xc4ebdb0, event=0xc164920) at kernel/qcoreapplication.cpp:731
#8 0xb5acfab5 in QCoreApplication::sendEvent (receiver=0xc4ebdb0, event=0xc164920) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:215
#9 0xb57ebf92 in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0xa349770) at kernel/qcoreapplication.cpp:1372
#10 0xb57ebc89 in QCoreApplication::sendPostedEvents (receiver=0x0, event_type=0) at kernel/qcoreapplication.cpp:1265
#11 0xb5b93b7e in QCoreApplication::sendPostedEvents () at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:220
#12 0xb5b9e90c in QEventDispatcherX11::processEvents (this=0xa34db70, flags=...) at kernel/qeventdispatcher_x11.cpp:75
#13 0xb57eb397 in QCoreApplication::processEvents (flags=...) at kernel/qcoreapplication.cpp:923
#14 0xb519d577 in meth_QCoreApplication_processEvents (sipArgs=0xb748b02c, sipKwds=0x0) at sipQtCoreQCoreApplication.cpp:667
#15 0xb7700ed8 in PyCFunction_Call (func=0xeefb84c, arg=0xb748b02c, kw=0x0) at Objects/methodobject.c:85
-------------- next part --------------
Thread 1
--------
(gdb) bt
#0 0xb7722424 in __kernel_vsyscall ()
#1 0xb756c7d5 in sem_wait@@GLIBC_2.1 () from /lib/i386-linux-gnu/libpthread.so.0
#2 0xb76a0840 in PyThread_acquire_lock (lock=0x8cd1bd8, waitflag=1) at Python/thread_pthread.h:309
#3 0xb7665418 in PyEval_RestoreThread (tstate=0x87b3050) at Python/ceval.c:356
#4 0xb50b2582 in meth_QCoreApplication_processEvents (sipArgs=0xb738e02c, sipKwds=0x0) at sipQtCoreQCoreApplication.cpp:668
Thread 2
--------
#0 0xb7722424 in __kernel_vsyscall ()
#1 0xb756c7d5 in sem_wait@@GLIBC_2.1 () from /lib/i386-linux-gnu/libpthread.so.0
#2 0xb76a0840 in PyThread_acquire_lock (lock=0x8cd1bd8, waitflag=1) at Python/thread_pthread.h:309
#3 0xb7665418 in PyEval_RestoreThread (tstate=0x9b8a8e8) at Python/ceval.c:356
#4 0xb768c770 in PyGILState_Ensure () at Python/pystate.c:609
#5 0xb557730b in sip_api_is_py_method (gil=0xb47a1344, pymc=0x9889544 "", sipSelfp=0x9889540, cname=0x0, mname=0xb5130276 "run") at siplib.c:7562
#6 0xb4fe01b2 in sipQThread::run (this=0x9889538) at sipQtCoreQThread.cpp:148
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_qt_bindings.py
Type: text/x-python
Size: 10033 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110920/4662fa89/attachment-0001.py>
More information about the PyQt
mailing list