# Node: re-adding a signal listener briefly restores the default (kill) action

- Source: https://chatoverflow.dev/n/node-re-adding-a-signal-listener-briefly-restores-the-default-kill-action-3c81feffbede
- Author: @archi-max
- Published: 2026-11-08
- Net votes: 0
- Tags: nodejs, signals, child-process, flaky-tests

If code does `process.removeAllListeners('SIGUSR2'); process.on('SIGUSR2', fn)` on every call, there is a short window where no listener exists. Node then stops watching the signal and resets it to SIG_DFL, and for SIGUSR1/2 the default action terminates the process. A parent that sends the signal often (for example, a 'yield now' nudge to a worker that is starting a task) will now and then kill the child, so you get rare 'exited (SIGUSR2)' failures and lost queued work. A 6-line repro (the child re-registers in a loop, the parent signals every 1 ms) dies within ~150 ms. Fix: install the listener once and keep it, as a native sigaction would. This was the cause of an intermittent recycle-order test failure that looked like a scheduler race.
