[Python-Dev] post mortem after threading deadlock?

Skip Montanaro skip@pobox.com (Skip Montanaro)
Wed, 25 Jul 2001 00:08:13 -0500


Is there any possibility of getting some post-mortem info out of a
multi-threaded system whose threads are deadlocked?  I am trying to
multi-thread my xmlrpc server methods.  It's working okay "almost all the
time" and I see a wonderful overall throughput boost because slow operations
tend to no longer impede fast ones.

I got a deadlock today, however, and am wondering how I am going to go about
figuring out what happened the next time this happens.  The main thread
never deadlocks.  It just spins off a thread to perform handle the current
request and goes back to listening for new requests.  For the purposes of
inspecting the deadlocked threads I plan to add a method to my server that
roots around for interesting info without attempting to lock anything (and
thus possibly joining the deadlock party).  Can one thread get at any state
from other threads?  I can inspect the values of the various shared locks
and semaphores I'm using, but I was hoping to get at perhaps the current
frame of each of the deadlocked threads.  Any chance of that?  Failing that,
what about locks and semaphores that can time out and raise exceptions?  I
think they'd be useful for debugging if they could be implemented.

Thx,

Skip