Dumping the state of a deadlocked process

MrJean1 MrJean1 at gmail.com
Fri Oct 6 23:18:45 CEST 2006


Did you try using the signal module?  If not, a basic example is here
<http://docs.python.org/lib/node546.html> which may need to be
extended.

/Jean Brouwers


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
> right.
>
> 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?




More information about the Python-list mailing list