If one of our linux system is overloaded, then I would like to take a snapshot of what is going on.
99% of our code is Python, that's why I would like to get a stacktrace of all running python interpreters.
I have no clue how to get the stacktrace of python processes.
This question is only about how to get the stacktrace. The condition which checks if I want it to happen is a different question (which is already solved).
I know that it is possible to get the stacktrace by using a signal handler (See here), but I would like to avoid this. The python source code should not get modified to solve this.
top
or look at the Windowstaskmgr
, to see which process is hogging CPU? And can't you limit their CPU somehow? In short, I am wondering of this is really the best question for you to ask :-)top
help? Can't you give them all unique process names, have another process which is a watchdog and when CPU > 90% it snapshots the offender? Or, can't you use the O/S's parameters tocreate process/thread
, to limit CPU usage, as you can stack size? Maybe adjust priority? You might get better help on unix.stackexchange.com