Saturday 21 August 2010

Dumping stack traces for all interpreter threads

Occasionally, I am using someone else's code which perhaps uses threads under the hood, and deadlock occurs. When this happens, I find myself looking for code to print stack traces for each of the interpreter threads, so I can work out what is going wrong.

This Stack Overflow post serves as a good source of cut and paste solutions. The solution in question that I went with was the dumpstacks function.

In this case, I am trying to run the Python socket unit tests against the monkey patched stacklesssocket module.

No comments:

Post a Comment