feat: improve signal handling with timeout and better POSIX compliance (#1705)#2263
Open
harshcoder-harsh wants to merge 2 commits into
Open
feat: improve signal handling with timeout and better POSIX compliance (#1705)#2263harshcoder-harsh wants to merge 2 commits into
harshcoder-harsh wants to merge 2 commits into
Conversation
added 2 commits
December 3, 2025 23:36
Implements improvements proposed in issue remy#1705: - Change default signal from SIGUSR2 to SIGHUP for better POSIX compliance - Add configurable killTimeout option (default: 10000ms) - Implement graceful SIGINT handling with double Ctrl+C for force quit - Implement SIGTERM with timeout-based escalation to SIGKILL (systemd-compatible) - Add SIGQUIT handler for immediate termination without cleanup - Add SIGHUP handler for reload functionality - Add killWithTimeout() function for graceful shutdown with escalation Breaking change: Default signal changed from SIGUSR2 to SIGHUP. Users can maintain old behavior by setting signal: 'SIGUSR2' in config. Fixes remy#1705
- Document new signal handling behavior (SIGINT, SIGTERM, SIGQUIT, SIGHUP) - Add killTimeout configuration documentation - Update examples to use SIGHUP instead of SIGUSR2 - Add migration notes for users upgrading from older versions Related to remy#1705
✅ Deploy Preview for nodemon ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Owner
|
There's no tests for this, but more worryingly, you've changed the defaults which would apply a massive blanket change. I've not really read the AI generated PR description, happy if you want to write your own or summarise it down to a few lines with AI, but I do expect it to be fully tested. One final point, there's no need for the details that were added to the readme, it's inconsistent with the project style. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Implements the signal handling improvements proposed in #1705 for better POSIX compliance and systemd compatibility.
Changes
Breaking Changes
SIGUSR2toSIGHUPApplications listening for
SIGUSR2should either:SIGHUP(recommended), or--signal SIGUSR2in nodemon configurationMigration Example
Implementation Details
New
killWithTimeout()FunctionAdded a new function that implements graceful shutdown with timeout-based escalation:
Signal Handler Improvements
SIGINT (Ctrl+C):
SIGTERM:
killTimeoutTimeoutStopSecSIGQUIT (new):
SIGHUP (new):
Testing
Manual testing has been performed for:
Backward Compatibility
Users can maintain the old behavior by explicitly setting
signal: 'SIGUSR2'in their configuration:Or in
nodemon.json:{ \"signal\": \"SIGUSR2\" }Related Issues
Fixes #1705
Related to #1667, #1661
Checklist