Skip to content

Commit 5b105fb

Browse files
addaleaxbcoe
authored andcommitted
fix: do not listen on SIGBUS, SIGFPE, SIGSEGV and SIGILL (#40)
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
1 parent 36d440a commit 5b105fb

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

signals.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@
1313
// fatal signal like SIGWINCH or something, and then
1414
// exit, it'll end up firing `process.emit('exit')`, so
1515
// the handler will be fired anyway.
16+
//
17+
// SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
18+
// artificially, inherently leave the process in a
19+
// state from which it is not safe to try and enter JS
20+
// listeners.
1621
module.exports = [
1722
'SIGABRT',
1823
'SIGALRM',
19-
'SIGBUS',
20-
'SIGFPE',
2124
'SIGHUP',
22-
'SIGILL',
2325
'SIGINT',
24-
'SIGSEGV',
2526
'SIGTERM'
2627
]
2728

0 commit comments

Comments
 (0)