Getting the * current * stack trace in node.js (e.g. via SIGINT)
I have a very intensive application. I wonder if it is possible to get the current stack trace in order to understand, for example, with a SIGINT termination where the particular function is the current computation.
I tried to add the following handler:
process.on('SIGINT', function() {
log('SIGINT!')
var stack = new Error().stack;
log( stack );
log('quitting.');
process.exit();
});
but it seems like it is only called when the intensive computation is complete, not immediately when I press Ctrl-C.
any idea on how to keep track of execution without polluting the code with log messages?
source to share
I don't have a specific answer for your problem, but I would look for synchronous code (e.g. fs. * Sync)
I suggest node-inspector ( https://github.com/node-inspector/node-inspector ) that allow you to get an idea of ββwhat is going on either step by step into the code and some posts about resource usage
source to share