-
Notifications
You must be signed in to change notification settings - Fork 30.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--cpu-prof not generate profile file when killed by SIGINT #27406
Comments
It's intentional. There is only a very limited number of things you're allowed to do from a signal handler, see signal-safety(7). Creating and writing out a CPU profile isn't one of them. edit: this is a partial duplicate of #24937 - specifically, it could be fixed if there was a watchdog thread for handling signals that communicates with the main thread. |
It seems that node-report can be generated by SIGUSR2, what makes cpu profile different? @joyeecheung |
node-report uses a mechanism that integrates with the Node.js event loop, |
I think we should be able to fix this based on best-effort - we can just not re-raise the signal directly but instead set something up, return normally, and then outside the handler, terminate the JS execution and do proper cleanups (like what we do for the REPL - which we also need to be careful about), including finishing the CPU profiling. We already have a SIGINT watchdog implemented, it's only used in very few places but not globally, though I am not sure if it's adequate for this as we have workers that can profile their own threads but SIGINT is per-process so we may need extra synchronization. I'll take a look. |
Ping @joyeecheung ... are you still planning to look at this? Should this remain open? |
@jasnell Sorry for missing this...yes I think it should remain open, but i don't currently have time to look into it |
I am working on refactoring for #33807 and I think some of the work there might be useful for this. Tentatively assigning this to myself. |
is this purpose ? or how can i get profile file when app killed by SIGINT?
The text was updated successfully, but these errors were encountered: