rdmsm4x-changelog-20260916-1234-replicantdb-sigpipe-issue-20260916-14
rdmsm4x-changelog-20260916-1234-replicantdb-sigpipe-issue-20260916-14
Remediated pre-existing SIGPIPE crash in replicantDB
ProcessFleetSearchTransport that caused
swift test to exit rc=1 at test #522 mid-suite.
- Host:
rdmsm4x - Scope:
replicantDB(Sources/ReplicantDBCore/FleetSearch.swift,Tests/ReplicantDBTests/FleetSearchTests.swift) - Ticket:
ISSUE-20260916-14(Resolved) - Worktree:
/Users/richh/dev/_worktrees/replicantdb-sigpipe-issue-20260916-14 - Branch:
fix/replicantdb-sigpipe-issue-20260916-14(commits56bce01,5dc08dc) pushed tobackupandfleetremotes.
Root Cause
In ProcessFleetSearchTransport.run, the parent process
writes script to
stdinPipe.fileHandleForWriting. When the child process
(/bin/sh -s or /usr/bin/ssh) terminates early
without reading all bytes from stdin (e.g. matching CLI schema marker
early, connection failure, or syntax/flag error), writing to the pipe
whose reader has closed delivered POSIX SIGPIPE to the
caller. Under default signal handling (SIG_DFL), this
abruptly killed the xctest process mid-run with signal code
13, masking the true test outcomes.
Remediation
- In
Sources/ReplicantDBCore/FleetSearch.swift, wrappedstdinHandle.writein a localizedsignal(SIGPIPE, SIG_IGN)block withdefer { signal(SIGPIPE, previousSignal) }. POSIXEPIPE/ Cocoa error 512 is safely caught and discarded without killing the host process or leaking signal modifications. - In
Tests/ReplicantDBTests/FleetSearchTests.swift, added regression testtestProcessTransportDoesNotCrashWithSIGPIPEWhenChildExitsWithoutReadingStdinvalidatingSIG_DFLresilience against early-exiting child processes. - Recorded root cause analysis and test metrics in
SESSION-STATE.md.
Verification Evidence
- Negative Control (before fix / reverted fix):
- Command:
swift test --filter testProcessTransportDoesNotCrashWithSIGPIPEWhenChildExitsWithoutReadingStdin - Output:
error: Process '.../xctest ...' exited with unexpected signal code 13 - Return Code:
1
- Command:
- Full Suite After Fix:
- Command:
swift test - Result:
1,346 passed, 0 failed, 0 unexpected, 0 crashes(234.141 seconds) - Return Code:
0
- Command:
- Ticket & Mail:
- Appended comment and resolved
ISSUE-20260916-14. - Broadcasted resolution on
agent_msg.zshand synced across fleet.
- Appended comment and resolved