From 4ff4187e30b0d751b9b1b2369afe098809e22b78 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Mon, 5 Sep 2016 14:07:28 +0200 Subject: [PATCH 1/3] 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. --- doc/api/process.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/api/process.md b/doc/api/process.md index 5f967d21159245..ace1c841d3e5d0 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -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. *Note*: Windows does not support sending signals, but Node.js offers some emulation with [`process.kill()`][], and [`ChildProcess.kill()`][]. Sending From a83799eba203bf344f3d49575c7dde697f5e9ca8 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Thu, 8 Sep 2016 15:10:40 +0200 Subject: [PATCH 2/3] [squash] reference manpage for kill(2) --- doc/api/process.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/api/process.md b/doc/api/process.md index ace1c841d3e5d0..8a9a826d2ba345 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -422,9 +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. +* `SIGBUS`, `SIGFPE`, `SIGSEGV` and `SIGILL`, when not raised artificially + using kill(2), inherently leave the process in a state from which it is not + safe to attempt to call JS listeners. *Note*: Windows does not support sending signals, but Node.js offers some emulation with [`process.kill()`][], and [`ChildProcess.kill()`][]. Sending From 46dddc186d7143a66072097ca65de4dd66c51b09 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Thu, 8 Sep 2016 15:16:57 +0200 Subject: [PATCH 3/3] [squash] describe what might happen when listening on these signals --- doc/api/process.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/api/process.md b/doc/api/process.md index 8a9a826d2ba345..fd67f55dbe2e1d 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -424,7 +424,9 @@ It is important to take note of the following: * `SIGSTOP` cannot have a listener installed. * `SIGBUS`, `SIGFPE`, `SIGSEGV` and `SIGILL`, when not raised artificially using kill(2), inherently leave the process in a state from which it is not - safe to attempt to call JS listeners. + safe to attempt to call JS listeners. Doing so might lead to the process + hanging in an endless loop, since listeners attached using `process.on()` are + called asynchronously and therefore unable to correct the underlying problem. *Note*: Windows does not support sending signals, but Node.js offers some emulation with [`process.kill()`][], and [`ChildProcess.kill()`][]. Sending