Spawn cat in its own session in testSuspendResumeProcess()#308
Merged
iCharlesHu merged 1 commit intoJun 11, 2026
Merged
Conversation
The test spawned `/bin/cat` with default `PlatformOptions`, so `cat` inherited the test runner's process group, then sent it `SIGSTOP`, leaving a stopped process in the runner's own process group. On POSIX, when a process group becomes orphaned and any member is stopped, `SIGHUP` followed by `SIGCONT` is sent to every process in the group. Under the full suite's concurrent process churn, that group intermittently became orphaned while `cat` was stopped, and the kernel delivered `SIGHUP` to every member of the group, including the test process, which exited on the signal. This surfaced only when the suite ran in parallel, as a bare signal-1 exit with no recorded test failure. Spawn `cat` with `createSession` so it runs in its own session, and stopping it no longer leaves a stopped member in the runner's group. `cat`'s own group is orphaned at `setsid` time, which POSIX exempts from the SIGHUP, so the suspend/resume assertions are unaffected.
iCharlesHu
approved these changes
Jun 11, 2026
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.
testSuspendResumeProcess()intermittently terminates the entire test process withSIGHUPunder the full suite, surfacing as a bare signal-1 exit with no recorded test failure. I found this during a failed CI run for unrelated changes in #261.The test spawns
/bin/catwith defaultPlatformOptions, socatinherits the test runner's process group, then sends itSIGSTOP, leaving a stopped process in the runner's own process group.On POSIX, when a process group becomes orphaned and any member is stopped,
SIGHUPfollowed bySIGCONTis sent to every process in the group. Per the POSIX_Exitdocs:Under the full suite's concurrent process churn, that group intermittently became orphaned while
catwas stopped, and the kernel deliveredSIGHUPto every member of the group, including the test process, which exited on the signal. This surfaced only when the suite ran in parallel.This PR spawns
catwithcreateSessionso it runs in its own session, and stopping it no longer leaves a stopped member in the runner's group.cat's own group is orphaned atsetsid()time, which POSIX exempts from theSIGHUP, so the suspend/resume assertions are unaffected:processGroupIDwould also work here, but usingcreateSessionmatchesmeasureCancelledTeardown().Tested this across 30 iterations of the full suite on a macOS GitHub Actions runner where it previously failed.