Ignore SIGPIPE process-wide — broken-pipe writes must not kill the server (Refs #320) - #328
Merged
Merged
Conversation
…the server
The default disposition killed the process in the kernel before write()
returned to Swift — unreachable by try?/do-catch — for any of ~26 stderr
sites or the stdout stdio transport (verified: delivered SIGPIPE → death
by signal 13, 2/2 on the pre-fix binary).
Sequenced per the diagnosis to avoid trading death-on-disconnect for
spin-on-disconnect:
1. verified stdin-EOF is the governing clean-shutdown path (rc=0,
independent of stdout state) BEFORE the change,
2. installed signal(SIGPIPE, SIG_IGN) in main.swift before any transport,
3. verified live that broken-pipe stdout + stdin EOF still exits rc=0.
SigpipeDispositionTests pins the disposition by delivering SIGPIPE to the
real spawned binary — deterministic and load-independent (pre 2/2 dead,
post 2/2 alive), unlike a bounded exit-after-EOF assertion, which
interleaved A/B showed would flake on pre-existing latency variance
(4s->40s+ on the unmodified binary; recorded as a separate observation).
Measurement honesty: an initial non-interleaved A/B wrongly suggested the
fix slowed shutdown; interleaving dissolved the signal into load noise.
Plan-tier note: implemented under unattended /idd-all — Plan deliberation
skipped per orchestrator contract, marked here.
1069 tests, 0 failures.
Refs #320
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.
Refs #320
Summary
No
SIGPIPEdisposition was ever set, so a broken-pipe write (any of ~26 stderr sites, or the stdout transport) killed the server in the kernel — unreachable by Swift error handling.signal(SIGPIPE, SIG_IGN)now installs at startup; broken-pipe writes becomeEPIPEerrnos the throwing write sites already swallow.Diagnosis-ordered safety sequence: (1) verified stdin-EOF is the clean-shutdown path before changing anything; (2) applied the fix; (3) verified live that broken-pipe stdout + stdin EOF still exits
rc=0(no spin).Verification
SigpipeDispositionTests: deliversSIGPIPEto the real spawned binary — pre-fix dies by signal 13 (2/2), post-fix survives (2/2). Deterministic and load-independent.Coordination
main.swiftis also touched by unmerged PR #307 (adds a--versioncase in the switch; this PR addssignal()above it) — different regions, trivial adjacency at merge.🤖 Generated by /idd-all. Do NOT add a GitHub close trailer — run /idd-close after merge.