Repository navigation
--cpu-prof not generate profile file when killed by SIGINT #27406
Description
Activity
- addedquestionIssues asking questions about Node.js.Issues asking questions about Node.js.wontfixIssues that will not be fixed.Issues that will not be fixed.
on Apr 25, 2019 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.
- addedduplicateIssues and PRs that are duplicates of other issues or PRs.Issues and PRs that are duplicates of other issues or PRs.and removedwontfixIssues that will not be fixed.Issues that will not be fixed.
on Apr 25, 2019 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,
uv_signal_start(). For that to work however the event loop needs to make forward progress, something that won't happen when your script is stuck in a loop.Reacted by hardfistI 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
- addedhelp wantedIssues that need assistance from volunteers or PRs that need help to proceed.Issues that need assistance from volunteers or PRs that need help to proceed.and removedquestionIssues asking questions about Node.js.Issues asking questions about Node.js.
on Oct 4, 2020 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.
- removedhelp wantedIssues that need assistance from volunteers or PRs that need help to proceed.Issues that need assistance from volunteers or PRs that need help to proceed.
on Oct 14, 2020 - addedv8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.and removedduplicateIssues and PRs that are duplicates of other issues or PRs.Issues and PRs that are duplicates of other issues or PRs.
on Dec 28, 2020 github-actions commented
on Jun 27, 2026 on Jun 27, 2026 – with GitHub ActionsContributorMore actionsThis issue has been marked as stale due to 210 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.- addedstaleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.
on Jun 27, 2026 github-actions commented
on Jul 28, 2026 on Jul 28, 2026 – with GitHub ActionsContributorMore actionsThis issue has been automatically closed after 30 days of inactivity following its stale status (no activity for a total of 120 days).
If this is still relevant, feel free to reopen it or leave a comment with additional details so we can continue the discussion.
is this purpose ? or how can i get profile file when app killed by SIGINT?