[PyQt] test case for deadlock in signal / slot new style
Erik Janssens
Erik.Janssens at conceptive.be
Mon Oct 4 21:27:59 BST 2010
Hi,
I finally got around writting a simple test case to demonstrate
the deadlock in the signal/slot new style connections.
The test case can be ran using the following command :
python -m nose.core -v -s test_deadlock.py:SignalSlotCase
depending on the speed of your computer, it might take some
tweaking to observe the deadlock, it occurs when 'emitted' and
'connected' are printed on the screen at the same time.
Here are some interesting observations :
- the deadlock happens independent of the QT / PyQT version
- the old_style never deadlocks
- this example won't work at all using PySide, it seems that PySide
doesn't support queued connections involving python objects.
I'm not sure what I have to do with this issue, is this a Qt, Python
or PyQt issue ??
Thanks,
Erik
-------------- next part --------------
Thread 1
========
#0 0x0012d422 in __kernel_vsyscall ()
#1 0x0013a245 in sem_wait@@GLIBC_2.1 () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/sem_wait.S:80
#2 0x0810abe8 in PyThread_acquire_lock (lock=0x85debb8, waitflag=1) at ../Python/thread_pthread.h:349
#3 0x080dbe9c in PyEval_RestoreThread (tstate=0x8281060) at ../Python/ceval.c:353
#4 0x080fdc78 in PyGILState_Ensure () at ../Python/pystate.c:592
#5 0x01dc8a06 in ?? () from /usr/lib/pymodules/python2.6/PyQt4/QtCore.so
#6 0x01dc495b in ?? () from /usr/lib/pymodules/python2.6/PyQt4/QtCore.so
#7 0x016423d8 in QMetaType::construct (type=257, copy=0x87d1950) at kernel/qmetatype.cpp:1116
#8 0x016491cc in queued_activate (sender=<value optimized out>, signal=<value optimized out>, c=0xb7201dd8, argv=0x87c06d0, semaphore=0x0) at kernel/qobject.cpp:3166
#9 0x0164b2b1 in QMetaObject::activate (sender=0x87bf998, m=0x87bf570, local_signal_index=0, argv=0x87c06d0) at kernel/qobject.cpp:3266
#10 0x0164b9ea in QMetaObject::activate (sender=0x87bf998, signal_index=4, argv=0x87c06d0) at kernel/qobject.cpp:3346
#11 0x0164ba2b in QMetaObject::activate (sender=0x87bf998, from_signal_index=4, to_signal_index=4, argv=0x87c06d0) at kernel/qobject.cpp:3204
#12 0x01dcbda4 in ?? () from /usr/lib/pymodules/python2.6/PyQt4/QtCore.so
#13 0x01dc4aec in ?? () from /usr/lib/pymodules/python2.6/PyQt4/QtCore.so
Thread 2
========
#0 0x0012d422 in __kernel_vsyscall ()
#1 0x00138015 in pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/pthread_cond_wait.S:122
#2 0x015348c2 in QMutexPrivate::wait (this=0xb7201ec0, timeout=-1) at thread/qmutex_unix.cpp:84
#3 0x01530072 in QMutex::lock (this=0xb7201eb0) at thread/qmutex.cpp:205
#4 0x01649dfb in QOrderedMutexLocker::relock (sender=0x87bf998, signal_index=2, receiver=0xb72020d8, method_index=4, type=0, types=0x0) at ../../include/QtCore/private/../../../src/corelib/thread/qorderedmutexlocker_p.h:83
#5 QOrderedMutexLocker (sender=0x87bf998, signal_index=2, receiver=0xb72020d8, method_index=4, type=0, types=0x0) at ../../include/QtCore/private/../../../src/corelib/thread/qorderedmutexlocker_p.h:72
#6 QMetaObjectPrivate::connect (sender=0x87bf998, signal_index=2, receiver=0xb72020d8, method_index=4, type=0, types=0x0) at kernel/qobject.cpp:2908
#7 0x0164a3b2 in QObject::connect (sender=0x87bf998, signal=0x877ab00 "2my_signal(PyQt_PyObject)", receiver=0xb72020d8, method=0xb7202180 "1my_slot(PyQt_PyObject)", type=Qt::AutoConnection) at kernel/qobject.cpp:2607
#8 0x01dc4f46 in ?? () from /usr/lib/pymodules/python2.6/PyQt4/QtCore.so
#9 0x01dc59e6 in ?? () from /usr/lib/pymodules/python2.6/PyQt4/QtCore.so
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_deadlock.py
Type: text/x-python
Size: 1348 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20101004/8bb6b507/attachment-0002.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_deadlock_oldstyle.py
Type: text/x-python
Size: 1356 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20101004/8bb6b507/attachment-0003.py>
More information about the PyQt
mailing list