Debugging threaded Python code

Derek Thomson derek at hiredgoons.org
Sun May 1 22:52:30 EDT 2005


Hi,

I frequently have to debug some fairly tricky Python multi-threaded 
code, and I need some help using the debugger to help me diagnose the 
problems when they occur. Yes, I know that the best option with threaded 
code that is problematic is to rewrite it, but that's not really an 
option that I have (right now).

What would really help me is to be able to see a list of all the 
currently active threads, and the Python stack trace for each. At least 
then I could see where the failures are happening - deadlocks in 
particular. I have to spend a lot of time right now just to reach that 
point.

I spent some time trying to achieve this with the Python debugger and 
couldn't. This has been bugging me for quite a while now, and I'm 
probably just missing the obvious as usual. Is there some simple way I 
can do this?

Thanks,
Derek.



More information about the Python-list mailing list