-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
doc: note that listening on SIGSEGV & co is unsafe #8410
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -422,6 +422,9 @@ It is important to take note of the following: | |
* `SIGKILL` cannot have a listener installed, it will unconditionally terminate | ||
Node.js on all platforms. | ||
* `SIGSTOP` cannot have a listener installed. | ||
* `SIGBUS`, `SIGFPE`, `SIGSEGV` and `SIGILL`, when not raised artificially, | ||
inherently leave the process in a state from which it is not safe to | ||
attempt to call JS listeners. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does core not call listeners then...? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. libuv schedules them to run, but the control flow returns from the signal handler before actually calling anything. As far as I have been able to tell, that means that the offending code will just be executed again, triggering the signal again, etc. in an infinite loop. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Fishrock123 sorry, occurs to me that I might have misread your question – node does try to call the listeners in the usual way, and that works perfectly when the signal is artificially generated, as in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Does that imply that we should not allow these signals to trigger when they are not artificial? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We might be able to do that… libuv would need to set
I am not sure what practical use cases for manually triggering There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @addaleax I mean, should these listeners even function if it is not safe? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Fishrock123 I would say no, but it’s probably not something worth the trouble of removing… |
||
|
||
*Note*: Windows does not support sending signals, but Node.js offers some | ||
emulation with [`process.kill()`][], and [`ChildProcess.kill()`][]. Sending | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raised artificially
is a bit obscure. I'm not sure the average reader will know that that means.