Skip to content

Commit 3207ea4

Browse files
addaleaxjasnell
authored andcommitted
doc: note that listening on SIGSEGV & co is unsafe
Note that trying to listen for some signals using `process.on()` is unsafe in the `process` docs. PR-URL: #8410 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 83a354c commit 3207ea4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

doc/api/process.md

+5
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,11 @@ It is important to take note of the following:
422422
* `SIGKILL` cannot have a listener installed, it will unconditionally terminate
423423
Node.js on all platforms.
424424
* `SIGSTOP` cannot have a listener installed.
425+
* `SIGBUS`, `SIGFPE`, `SIGSEGV` and `SIGILL`, when not raised artificially
426+
using kill(2), inherently leave the process in a state from which it is not
427+
safe to attempt to call JS listeners. Doing so might lead to the process
428+
hanging in an endless loop, since listeners attached using `process.on()` are
429+
called asynchronously and therefore unable to correct the underlying problem.
425430

426431
*Note*: Windows does not support sending signals, but Node.js offers some
427432
emulation with [`process.kill()`][], and [`ChildProcess.kill()`][]. Sending

0 commit comments

Comments
 (0)