Debugging SocketServer.ThreadingTCPServer

Jean-Paul Calderone exarkun at divmod.com
Tue Jan 16 09:11:38 EST 2007


On Tue, 16 Jan 2007 00:23:35 -0500, "Stuart D. Gathman" <stuart at bmsi.com> wrote:
>I have a ThreadingTCPServer application (pygossip, part of
>http://sourceforge.net/projects/pymilter).  It mostly runs well, but
>occasionally goes into a loop.  How can I get a stack trace of running
>threads to figure out where the loop is?  Is there some equivalent of
>sending SIGQUIT to Java to get a thread dump?  If needed, I can import pdb
>and set options at startup, but there needs to be some external way of
>triggering the dump since I can't reproduce it at will.

Grab the gdbinit out of Python SVN Misc/ directory.  Apply this patch:

  http://jcalderone.livejournal.com/28224.html

Attach to the process using gdb.  Make sure you have debugging symbols
in your build of Python.  Run 'thread apply all pystack'.

Jean-Paul



More information about the Python-list mailing list