-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Closed
Labels
cliIssues and PRs related to the Node.js command line interface.Issues and PRs related to the Node.js command line interface.feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.
Description
It would be exceedingly nice for debugging non-responsive scripts if terminating the process with ^C / SIGINT prints a JS stack trace leading up to the currently executing code.
The use case is scripts stuck in (for example) infinite loops. Right now you don't really get an indication when that's happening except CPU usage in top.
It might be hard to pull off because signal handlers but maybe someone has a clever idea. My attempt at being clever:
- Route signals to a watchdog thread instead of the main thread
- Call
isolate->RequestInterrupt()when a signal is received. - Collect the stack trace in the interrupt handler.
- Either re-raise the signal on the main thread to terminate as usual, or raise a termination exception to kill the script.
targos, sindresorhus, mmarchini, silverwind and sleekweaselsleekweasel
Metadata
Metadata
Assignees
Labels
cliIssues and PRs related to the Node.js command line interface.Issues and PRs related to the Node.js command line interface.feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.