11

Is there a way to get a thread dump from a running Python process? Similar to kill -3 on a Java process.

oneself
  • 36,307
  • 31
  • 91
  • 119
  • Does this answer your question? [Showing the stack trace from a running Python application](https://stackoverflow.com/questions/132058/showing-the-stack-trace-from-a-running-python-application) – rogerdpack Mar 15 '22 at 16:49

1 Answers1

4

I havent seen anything built-in, but I have seen a solution here which can be exposed via http console. The solution iterates over all threads and outputs the stack.

akf
  • 37,507
  • 8
  • 85
  • 95
  • 1
    So the answer is that Python doesn't have this mechanism built in, right? – oneself Aug 20 '09 at 13:38
  • I'm running this in Pylons via Apache, and the problem is that each process runs a single thread. So, the thread-dump is always for the thread that called for a dump, and so is always identical, and useless. – oneself Aug 26 '11 at 21:50