Dumping the state of a deadlocked process
ziga.seilnacht at gmail.com
Sat Oct 7 11:49:21 CEST 2006
andre.naess at gmail.com wrote:
> Hi all
> I'm currently having some issues with a process getting deadlocked. The
> problem is that the only way I can seem to find information about where
> it deadlocks is by making a wild guess, insert a pdb.set_trace() before
> this point, and then step until it locks up, hoping that I've guessed
> The frustrating part is that most of the time my guesses are wrong.
> It would be really nice if I could send the python process some signal
> which would cause it to print the current stacktrace and exit
> immediately. That way I would quickly be able to pinpoint where in the
> code the deadlock happens. Java has a somewhat similar feature where
> you can send a running VM process a SIGQUIT, to which it will respond
> by dumping all current threads and lots of other information on stdout.
> Is this possible somehow?
Check out the sys._current_frames() function, new in Python 2.5:
Hope this helps,
More information about the Python-list