FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

src,lib: make ^C print a JS stack trace by legendecas · Pull Request #29207 · nodejs/node · GitHub

/ node Public

src,lib: make ^C print a JS stack trace - #29207

Closed
legendecas wants to merge 1 commit into
nodejs:masterfrom
legendecas:issue-24937
Closed

src,lib: make ^C print a JS stack trace#29207
legendecas wants to merge 1 commit into
nodejs:masterfrom
legendecas:issue-24937

Conversation

legendecas commented Aug 19, 2019
edited
Loading

Copy link
Copy Markdown
Member

If terminating the process with ctrl-c / SIGINT, prints a JS stack trace leading up to the currently executing code.

The feature would be enabled under option --trace-sigint.

Conditions of no stacktrace on sigint:

  1. has (an) active sigint listener(s);
  2. main thread is idle (i.e. uv polling), a message instead of stacktrace would be printed.

Related: #24937

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Aug 19, 2019
Comment thread lib/internal/main/run_main_module.js Outdated

mscdex commented Aug 19, 2019
edited
Loading

Copy link
Copy Markdown
Contributor

Maybe we should only print a stack trace if stdin is a TTY (especially if it's meant to only happen when pressing ctrl-c)?

devsnek added the wip Issues and PRs that are still a work in progress. label Aug 19, 2019
Comment thread lib/internal/main/run_main_module.js Outdated
Comment thread src/node_watchdog.cc Outdated
Comment thread src/node_watchdog.cc Outdated
Comment thread src/node_watchdog.cc Outdated
Comment thread src/node_watchdog.cc Outdated

bnoordhuis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Left some comments but nice work!

Comment thread src/node_watchdog.cc Outdated
Comment thread src/node_watchdog.cc Outdated
Comment thread src/node_watchdog.cc Outdated
Comment thread src/node_watchdog.cc Outdated
Comment thread src/node_watchdog.cc Outdated
Comment thread src/node_watchdog.cc Outdated
Comment thread src/node_watchdog.cc Outdated
Comment thread src/node_watchdog.cc Outdated
Comment thread src/node_watchdog.cc Outdated
Comment thread src/node_watchdog.cc Outdated
legendecas force-pushed the issue-24937 branch 3 times, most recently from 503aca6 to f175639 Compare August 24, 2019 13:14
legendecas changed the title cli: make ^C print a JS stack trace report: make ^C print a JS stack trace Aug 24, 2019

addaleax left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

report: is the subsystem for the node-report feature, i.e. node --experimental-report … this touches a related topic, but I think it might be confusing to name it that way

Comment thread src/node_watchdog.h Outdated
Comment thread src/node_watchdog.h Outdated
Comment thread src/node_watchdog.cc Outdated
Comment thread lib/internal/main/run_main_module.js Outdated

Copy link
Copy Markdown
Member Author

report: is the subsystem for the node-report feature, i.e. node --experimental-report … this touches a related topic, but I think it might be confusing to name it that way

Yes, this work doesn't touch report specifically in codebase. Yet I don't find a more proper subsystem here https://github.com/nodejs/core-validate-commit/blob/master/lib/rules/subsystem.js . Since both src and lib are touched in this work, neither of those one might be appropriate IMO.

Copy link
Copy Markdown
Member

@legendecas You can also use src,lib: .... 🙂 Honestly, I don’t have a better idea than that either.

legendecas changed the title report: make ^C print a JS stack trace src,lib: make ^C print a JS stack trace Aug 24, 2019
legendecas force-pushed the issue-24937 branch 2 times, most recently from 3797e8e to 822e56a Compare August 24, 2019 14:13
Comment thread lib/internal/bootstrap/pre_execution.js Outdated
legendecas force-pushed the issue-24937 branch 2 times, most recently from 124c8c3 to b7ccab2 Compare August 24, 2019 16:44

Copy link
Copy Markdown
Member Author

I think this PR is out of WIP, ready to be reviewed thoroughly :)

addaleax removed the wip Issues and PRs that are still a work in progress. label Aug 24, 2019
Comment thread src/node_watchdog.h Outdated

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Member

Copy link
Copy Markdown
Member

@legendecas Looks like there are still issues with the postmortem tests…

Copy link
Copy Markdown
Member Author

@legendecas Looks like there are still issues with the postmortem tests…

I'll try to fix it :P

Comment thread lib/internal/bootstrap/pre_execution.js Outdated
Comment thread lib/internal/watchdog.js Outdated
Comment thread lib/internal/watchdog.js Outdated
Fishrock123 removed their request for review January 14, 2020 19:49

Fishrock123 commented Jan 14, 2020
edited
Loading

Copy link
Copy Markdown
Contributor

I don't have any substantive opinions for this.

Copy link
Copy Markdown
Member Author

Since there are no objections anymore and multiple approves, I'd tag this as author-ready.

legendecas added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Jan 17, 2020
If terminating the process with ctrl-c / SIGINT, prints a JS stacktrace
leading up to the currently executing code.

The feature would be enabled under option --trace-sigint.

Conditions of no stacktrace on sigint:

- has (an) active sigint listener(s);
- main thread is idle (i.e. uv polling), a message instead of stacktrace
  would be printed.
legendecas removed the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Jan 25, 2020

Copy link
Copy Markdown
Member Author

Rebased to resolve conflicts.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

Copy link
Copy Markdown
Collaborator

legendecas added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Jan 26, 2020
legendecas added a commit that referenced this pull request Jan 28, 2020
If terminating the process with ctrl-c / SIGINT, prints a JS stacktrace
leading up to the currently executing code.

The feature would be enabled under option `--trace-sigint`.

Conditions of no stacktrace on sigint:

- has (an) active sigint listener(s);
- main thread is idle (i.e. uv polling), a message instead of stacktrace
  would be printed.

PR-URL: #29207
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Christopher Hiller <boneskull@boneskull.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>

Copy link
Copy Markdown
Member Author

Landed with 7b7e7bd 🎉

legendecas closed this Jan 28, 2020
legendecas deleted the issue-24937 branch January 28, 2020 05:54

ruyadorno commented Jan 28, 2020
edited
Loading

Copy link
Copy Markdown
Member

/cc @nodejs/tooling this landed 🎉 yay! we might want to talk about it in the next tooling WG meeting

codebytere pushed a commit that referenced this pull request Feb 17, 2020
If terminating the process with ctrl-c / SIGINT, prints a JS stacktrace
leading up to the currently executing code.

The feature would be enabled under option `--trace-sigint`.

Conditions of no stacktrace on sigint:

- has (an) active sigint listener(s);
- main thread is idle (i.e. uv polling), a message instead of stacktrace
  would be printed.

PR-URL: #29207
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Christopher Hiller <boneskull@boneskull.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
codebytere mentioned this pull request Feb 17, 2020
targos removed the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Apr 25, 2020
targos pushed a commit to targos/node that referenced this pull request Apr 25, 2020
If terminating the process with ctrl-c / SIGINT, prints a JS stacktrace
leading up to the currently executing code.

The feature would be enabled under option `--trace-sigint`.

Conditions of no stacktrace on sigint:

- has (an) active sigint listener(s);
- main thread is idle (i.e. uv polling), a message instead of stacktrace
  would be printed.

PR-URL: nodejs#29207
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Christopher Hiller <boneskull@boneskull.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
targos pushed a commit that referenced this pull request Apr 28, 2020
If terminating the process with ctrl-c / SIGINT, prints a JS stacktrace
leading up to the currently executing code.

The feature would be enabled under option `--trace-sigint`.

Conditions of no stacktrace on sigint:

- has (an) active sigint listener(s);
- main thread is idle (i.e. uv polling), a message instead of stacktrace
  would be printed.

PR-URL: #29207
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Christopher Hiller <boneskull@boneskull.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>

orgads commented Jan 30, 2025

Copy link
Copy Markdown
Contributor

Is it possible to extend this also for sigterm (with a separate flag)?

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. semver-minor PRs that contain new features and should be released in the next minor version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.


Back | FazBrowse Home | New Git URL