[PyKDE] Re: Threading problem with PyQt4 and Macosx
Matt Newell
newellm at blur.com
Fri Feb 23 19:18:15 GMT 2007
On Friday 23 February 2007 09:15, Phil Thompson wrote:
> On Friday 23 February 2007 5:00 pm, Michael Guntsche wrote:
> > On Feb 23, 2007, at 17:09, Phil Thompson wrote:
> > > The Python 2.5 binary from python.org. Qt, SIP and PyQt all built
> > > without any
> > > flags to their respecting configure scripts.
> >
> > Ok, I officially give up now, no more ideas.
> > Is there any way I can debug this further?
>
> Just the usual. It's seems to be a deadlock as it only seems to be a
> problem if you have 2 cores.
>
> Phil
>
I can reproduce this problem with the latest snapshot. It seems that the main
thread is waiting on a semaphore(Qt) for the worker threads while holding the
python GIL. The worker threads all get stuck waiting for the GIL.
I'm going to compile a debug build and see if i can't figure this out further,
here is the traces I have now with a release build.
Matt
--------- Main Thread BT -------------------
(gdb) bt
#0 0xb7f74c01 in pthread_cond_wait@@GLIBC_2.3.2 ()
from /lib/tls/libpthread.so.0
#1 0xb7af7ca1 in QWaitCondition::wait (this=0x834fd18, mutex=0x834fd10,
time=4294967295) at thread/qwaitcondition_unix.cpp:254
#2 0xb7af406b in QReadWriteLock::lockForWrite (this=0x834e878) at
thread/qreadwritelock.cpp:174
#3 0xb7badfdf in ~QObject (this=0x837aef0)
at ../../include/QtCore/../../src/corelib/thread/qreadwritelock.h:122
#4 0xb6e7fc8d in ~QTextDocument (this=0x837aef0) at
text/qtextdocument.cpp:302
#5 0xb6fcc673 in QLabelPrivate::clearContents (this=0x837b210) at
widgets/qlabel.cpp:1167
#6 0xb6fccaee in QLabel::setText (this=0x837af00, text=@0x8403eb0) at
widgets/qlabel.cpp:314
#7 0xb75ae3fe in initQtGui ()
from /usr/lib/python2.4/site-packages/PyQt4/QtGui.so
#8 0x080b9485 in PyEval_EvalFrame ()
#9 0x080ba745 in PyEval_EvalCodeEx ()
#10 0x08100b59 in PyClassMethod_New ()
#11 0x080589d7 in PyObject_Call ()
#12 0x0805e28e in PyClass_IsSubclass ()
#13 0x080589d7 in PyObject_Call ()
#14 0x080b3d2d in PyEval_CallObjectWithKeywords ()
#15 0xb7f99ee5 in initsip () from /usr/lib/python2.4/site-packages/sip.so
#16 0xb7c75089 in initQtCore ()
from /usr/lib/python2.4/site-packages/PyQt4/QtCore.so
#17 0xb7c75992 in initQtCore ()
from /usr/lib/python2.4/site-packages/PyQt4/QtCore.so
#18 0xb7c75abc in initQtCore ()
from /usr/lib/python2.4/site-packages/PyQt4/QtCore.so
#19 0xb7bad5b5 in QMetaObject::activate (sender=0x83cd338,
from_signal_index=29, to_signal_index=30, argv=<value optimized out>) at
kernel/qobject.cpp:2940
#20 0xb7bad843 in QMetaObject::activate (sender=0x83cd338, m=0xb72ba104,
from_local_signal_index=2, to_local_signal_index=3, argv=0xbfa9ecfc) at
kernel/qobject.cpp:2992
#21 0xb715aea3 in QAbstractButton::clicked (this=0x83cd338, _t1=false)
at .moc/release-shared/moc_qabstractbutton.cpp:178
#22 0xb6f8856c in QAbstractButtonPrivate::emitClicked (this=0x8394758) at
widgets/qabstractbutton.cpp:517
#23 0xb6f89d67 in QAbstractButtonPrivate::click (this=0x8394758) at
widgets/qabstractbutton.cpp:510
#24 0xb6f89f70 in QAbstractButton::mouseReleaseEvent (this=0x83cd338,
e=0xbfa9f3f4) at widgets/qabstractbutton.cpp:1076
#25 0xb7510d0c in initQtGui ()
from /usr/lib/python2.4/site-packages/PyQt4/QtGui.so
#26 0xb6d473b3 in QWidget::event (this=0x83cd338, event=0xbfa9f3f4) at
kernel/qwidget.cpp:5698
#27 0xb6f88f73 in QAbstractButton::event (this=0x83cd338, e=0xbfa9f3f4) at
widgets/qabstractbutton.cpp:1038
#28 0xb6ffd444 in QPushButton::event (this=0x83cd338, e=0xbfa9f3f4) at
widgets/qpushbutton.cpp:582
#29 0xb750c480 in initQtGui ()
from /usr/lib/python2.4/site-packages/PyQt4/QtGui.so
#30 0xb6d0609c in QApplicationPrivate::notify_helper (this=0x8249e30,
receiver=0x83cd338, e=0xbfa9f3f4) at kernel/qapplication.cpp:3434
#31 0xb6d085bd in QApplication::notify (this=0x826bf08, receiver=0x83cd338,
e=0xbfa9f3f4) at kernel/qapplication.cpp:3133
#32 0xb76ebf03 in initQtGui ()
from /usr/lib/python2.4/site-packages/PyQt4/QtGui.so
#33 0xb6d5c8cb in QETWidget::translateMouseEvent (this=0x83cd338,
event=0xbfa9f6a8)
at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:186
#34 0xb6d5beef in QApplication::x11ProcessEvent (this=0x826bf08,
event=0xbfa9f6a8) at kernel/qapplication_x11.cpp:2764
#35 0xb6d7eb43 in QEventDispatcherX11::processEvents (this=0x827aa28,
flags=@0xbfa9f794) at kernel/qeventdispatcher_x11.cpp:112
#36 0xb7b9a751 in QEventLoop::processEvents (this=0xbfa9f800,
flags=@0xbfa9f7c8) at kernel/qeventloop.cpp:126
#37 0xb7b9a85a in QEventLoop::exec (this=0xbfa9f800, flags=@0xbfa9f808) at
kernel/qeventloop.cpp:172
#38 0xb7b9c9c6 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:727
#39 0xb6d05b37 in QApplication::exec () at kernel/qapplication.cpp:2927
#40 0xb76ecc1d in initQtGui ()
from /usr/lib/python2.4/site-packages/PyQt4/QtGui.so
#41 0x080b9485 in PyEval_EvalFrame ()
#42 0x080ba745 in PyEval_EvalCodeEx ()
#43 0x080ba7a9 in PyEval_EvalCode ()
#44 0x080dd157 in PyRun_FileExFlags ()
#45 0x080dd354 in PyRun_SimpleFileExFlags ()
#46 0x08055ba8 in Py_Main ()
#47 0x08055032 in main ()
----------- All the theads have this bt except for one, which is below -------
(gdb) thread 2
[Switching to thread 2 (Thread -1231635536 (LWP 19066))]#0 0xb7f769ab in
sem_wait at GLIBC_2.0 () from /lib/tls/libpthread.so.0
(gdb) bt
#0 0xb7f769ab in sem_wait at GLIBC_2.0 () from /lib/tls/libpthread.so.0
#1 0xb696bb90 in ?? ()
#2 0x080e155d in PyThread_acquire_lock ()
#3 0x080b43fd in PyEval_RestoreThread ()
#4 0xb7c8e164 in initQtCore ()
from /usr/lib/python2.4/site-packages/PyQt4/QtCore.so
#5 0x080b9485 in PyEval_EvalFrame ()
#6 0x080ba745 in PyEval_EvalCodeEx ()
#7 0x08100b59 in PyClassMethod_New ()
#8 0x080589d7 in PyObject_Call ()
#9 0x0805e28e in PyClass_IsSubclass ()
#10 0x080589d7 in PyObject_Call ()
#11 0x080b3d2d in PyEval_CallObjectWithKeywords ()
#12 0xb7f97fec in initsip () from /usr/lib/python2.4/site-packages/sip.so
#13 0xb7c7169d in ?? () from /usr/lib/python2.4/site-packages/PyQt4/QtCore.so
#14 0xb7c8f048 in initQtCore ()
from /usr/lib/python2.4/site-packages/PyQt4/QtCore.so
#15 0xb7af6f54 in QThreadPrivate::start (arg=0x83937b0) at
thread/qthread_unix.cpp:146
#16 0xb7f720bd in start_thread () from /lib/tls/libpthread.so.0
#17 0xb7ed892e in clone () from /lib/tls/libc.so.6
-----------------------------------------------------
(gdb) thread 4
[Switching to thread 4 (Thread -1248752720 (LWP 19068))]#0 0xb7f769ab in
sem_wait at GLIBC_2.0 () from /lib/tls/libpthread.so.0
(gdb) bt
#0 0xb7f769ab in sem_wait at GLIBC_2.0 () from /lib/tls/libpthread.so.0
#1 0xb5918b90 in ?? ()
#2 0x080e155d in PyThread_acquire_lock ()
#3 0x080b43fd in PyEval_RestoreThread ()
#4 0x080daff6 in PyGILState_Ensure ()
#5 0xb7c71a97 in ?? () from /usr/lib/python2.4/site-packages/PyQt4/QtCore.so
#6 0xb7c7a1ab in initQtCore ()
from /usr/lib/python2.4/site-packages/PyQt4/QtCore.so
#7 0xb7ba4294 in QMetaType::construct (type=296, copy=0xb5917de8) at
kernel/qmetatype.cpp:1050
#8 0xb7bad3f9 in QMetaObject::activate (sender=0x83958a0,
from_signal_index=4, to_signal_index=4, argv=0xb5917dac) at
kernel/qobject.cpp:2851
#9 0xb7bae0ac in QMetaObject::activate (sender=0x83958a0, m=0xb7d6b284,
local_signal_index=0, argv=0xb5917dac) at kernel/qobject.cpp:2983
#10 0xb7c74481 in initQtCore ()
from /usr/lib/python2.4/site-packages/PyQt4/QtCore.so
#11 0xb7c74507 in initQtCore ()
from /usr/lib/python2.4/site-packages/PyQt4/QtCore.so
#12 0xb7f99c70 in initsip () from /usr/lib/python2.4/site-packages/sip.so
#13 0xb7d26a8b in initQtCore ()
from /usr/lib/python2.4/site-packages/PyQt4/QtCore.so
#14 0x080b9485 in PyEval_EvalFrame ()
#15 0x080ba745 in PyEval_EvalCodeEx ()
#16 0x08100b59 in PyClassMethod_New ()
#17 0x080589d7 in PyObject_Call ()
#18 0x0805e28e in PyClass_IsSubclass ()
#19 0x080589d7 in PyObject_Call ()
#20 0x080b3d2d in PyEval_CallObjectWithKeywords ()
#21 0xb7f97fec in initsip () from /usr/lib/python2.4/site-packages/sip.so
#22 0xb7c7169d in ?? () from /usr/lib/python2.4/site-packages/PyQt4/QtCore.so
#23 0xb7c8f048 in initQtCore ()
from /usr/lib/python2.4/site-packages/PyQt4/QtCore.so
#24 0xb7af6f54 in QThreadPrivate::start (arg=0x838e2d8) at
thread/qthread_unix.cpp:146
#25 0xb7f720bd in start_thread () from /lib/tls/libpthread.so.0
#26 0xb7ed892e in clone () from /lib/tls/libc.so.6
Matt
More information about the PyQt
mailing list