Skip to content

Commit

Permalink
Do not listen on SIGBUS, SIGFPE, SIGSEGV and SIGILL
Browse files Browse the repository at this point in the history
Listening for one of these signals from JS will make the process
enter an infinite loop when encountering them naturally
because the underlying problem is not resolved while the signal
handler is being scheduled.

Ref: npm/npm#13782
Ref: nodejs/node#8410
  • Loading branch information
addaleax committed Sep 5, 2016
1 parent 36d440a commit b7bda9f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions signals.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@
// fatal signal like SIGWINCH or something, and then
// exit, it'll end up firing `process.emit('exit')`, so
// the handler will be fired anyway.
//
// SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
// artificially, inherently leave the process in a
// state from which it is not safe to try and enter JS
// listeners.
module.exports = [
'SIGABRT',
'SIGALRM',
'SIGBUS',
'SIGFPE',
'SIGHUP',
'SIGILL',
'SIGINT',
'SIGSEGV',
'SIGTERM'
]

Expand Down

0 comments on commit b7bda9f

Please sign in to comment.