[PyKDE] pyqt/mysqld thread deadlock
Kaleb Pederson
kibab at icehouse.net
Wed Jan 1 19:00:01 GMT 2003
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Ok. I have a PyQt program using mysql as a database with mysqldb as my
database client. I'm spawning qt threads to do all the work before I call a
postevent to let my application know I'm done.
It turns out, however, that the thread locks in the middle of my run() call
and never completes. I'm cross-posting this message as I'm not familiar with
Python extension modules and I don't know if PyQt could have caused this, it
is a Python bug (or feature) or if there is a problem in the mysqldb module
code.
Here's my run call:
def run(self):
""" called after the thread is spawned """
try:
# never makes it through the quick_find_customer call....
self.data = quick_find.quick_find_customer(self.parameters)
print "quick find returned:",self.data
event = QCustomEvent(self.eventID)
event.setData(self.data)
QThread.postEvent(self.receiver,event)
except Exception, msg:
print msg
I traced through everything and it seems to be blocking in the mysql code:
def _execute(self, query, args):
# makes it into the function but ...
from types import ListType, TupleType
from sys import exc_info
# it never makes it this far....
try:
if args is None:
r = self._query(query)
Once it locks, I get the following backtrace (using a full debug build of
Python/PyQt/etc.):
#0 0x4019fd49 in sigsuspend () from /lib/libc.so.6
#1 0x40033858 in __pthread_wait_for_restart_signal () from
/lib/libpthread.so.0
#2 0x400300eb in pthread_cond_wait () from /lib/libpthread.so.0
#3 0x080b5c0e in PyThread_acquire_lock (lock=0x813d418, waitflag=1) at
Python/thread_pthread.h:374
#4 0x080a5874 in lock_import () at Python/import.c:166
#5 0x080a81b2 in PyImport_ImportModuleEx (name=0x8182fc4 "types",
globals=0x87f56a4, locals=0x8114484, fromlist=0x87f83f4)
at Python/import.c:1657
#6 0x080f617b in builtin___import__ (self=0x0, args=0x813ab0c) at
Python/bltinmodule.c:40
#7 0x080f3ec6 in PyCFunction_Call (func=0x81379f0, arg=0x813ab0c, kw=0x0) at
Objects/methodobject.c:79
#8 0x080cdd9b in PyObject_Call (func=0x81379f0, arg=0x813ab0c, kw=0x0) at
Objects/abstract.c:1688
#9 0x0808ea7b in PyEval_CallObjectWithKeywords (func=0x81379f0, arg=0x813ab0c,
kw=0x0) at Python/ceval.c:3058
#10 0x0808a3f8 in eval_frame (f=0x852f99c) at Python/ceval.c:1843
<snip>
#32 0x0808d204 in PyEval_EvalCodeEx (co=0x870c6b0, globals=0x871a6cc,
locals=0x0, args=0x81e2d78, argcount=1, kws=0x0, kwcount=0,
defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:2595
#33 0x080e30df in function_call (func=0x870f34c, arg=0x81e2d64, kw=0x0) at
Objects/funcobject.c:374
#34 0x080cdd9b in PyObject_Call (func=0x870f34c, arg=0x81e2d64, kw=0x0) at
Objects/abstract.c:1688
#35 0x080d6f80 in instancemethod_call (func=0x870f34c, arg=0x81e2d64, kw=0x0)
at Objects/classobject.c:2292
#36 0x080cdd9b in PyObject_Call (func=0x8582af4, arg=0x81e2d64, kw=0x0) at
Objects/abstract.c:1688
#37 0x0808ea7b in PyEval_CallObjectWithKeywords (func=0x8582af4,
arg=0x81e2d64, kw=0x0) at Python/ceval.c:3058
#38 0x40023ecb in sipEvalMethod (pm=0x8734788, args=0x81e2d64) at
siplib.c:2898
#39 0x414a85a4 in sipQThread::sipVH_run(sipMethodCache const*, _sipThisType*)
()
from /usr/local/lib/python2.2/site-packages/libqtcmodule.so
#40 0x414a8553 in sipQThread::run() () from
/usr/local/lib/python2.2/site-packages/libqtcmodule.so
#41 0x40517726 in QThreadPrivate::start(QThread*) (thread=0x8734778) at
kernel/qthread_unix.cpp:79
- ---Type <return> to continue, or q <return> to quit---
#42 0x4051675b in start_thread (_arg=0x87327a0) at kernel/qthread_unix.cpp:98
#43 0x40031160 in pthread_start_thread () from /lib/libpthread.so.0
#44 0x40031262 in pthread_start_thread_event () from /lib/libpthread.so.0
So does anyone have any idea what's wrong or how to fix it? Please email me as
well if you aren't posting to the PyQt/Python list (kibab at icehouse dot
net).
- --Kaleb
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+EyxOeAVt8Tl/2kURApe3AJ9Sf5oBy2/+iKN3L5eS5YWsSGwK8ACfQQv8
sUmiu7EUmYRCglp0NkHaM8E=
=sxi1
-----END PGP SIGNATURE-----
More information about the PyQt
mailing list