Is it possible to print the stack trace of a nodejs app when it is becoming very slow or froze to get information about performance spikes?
This would be incredibly helpful in instances where the reproduction for the issue is unknown.
In Java this saved hundreds of hours and was straight forward:
- spawn a new "watchdog" thread
- send a heartbeat every 50ms from the main thread to the watchdog
- if the "watchdog" doesn't receive a heartbeat for +200ms, log the main threads stacktrace
Is something like this possible with nodejs?
FI: the nodejs diagnostics report doesn't contain any javascript stack trace when initiated from a sig kill event.