You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite. Learn more
This PR fixes a well-known container issue: when Node.js runs as PID 1 (common in Docker containers), re-raising SIGINT/SIGTERM with process.kill(process.pid, signal) can be swallowed by the kernel because PID 1 has no default signal disposition unless explicitly set. The fix detects PID 1 and calls process.exit() with the POSIX-conventional exit code instead.
What's good
Correct exit codes. 130 (128+SIGINT=2) and 143 (128+SIGTERM=15) are the de-facto Unix convention for signal-terminated exits. Container runtimes and orchestrators (Kubernetes, ECS) interpret these correctly.
Exhaustive switch.signalExitCode covers both ShutdownSignal variants explicitly with no _ fallthrough — consistent with the project's enum-matching convention.
Minimal scope. The fix is surgical: two call sites replaced, one helper added, zero changes to shutdown sequencing logic.
Comment quality. The inline comment on the second-delivery path explains why the behaviour changed, not what the code does, which is exactly the right bar.
Minor observations
process.pid check is reliable. In Linux PID namespaces (the common Docker case), the init process always sees itself as PID 1. Outside a PID namespace (e.g., --pid=host), it won't be PID 1 and the original process.kill path fires correctly. Logic is sound.
PR checklist is empty. The description template boxes are all unchecked. Not a blocker for this focused fix, but worth capturing how this was manually verified (e.g., a docker run --init=false smoke test).
No automated test coverage. PID 1 behaviour is difficult to unit-test without a real container. A follow-up integration test in the existing platform smoke-test harness (packages/rivetkit/tests/platforms/) would be useful if one doesn't exist.
Verdict
The fix is correct, minimal, and follows project conventions. Ready to merge once promoted from draft and the manual verification story is captured.
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
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
Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist: