Repository navigation
Give the no-PID keyed test a socket that refuses whoever holds it - #212
Merged
Merged
Conversation
a_record_naming_no_pid_is_probed_but_never_turned_into_a_loss dropped its UnixListener and expected the next probe to be refused. A dropped listener can still accept: pty-core's unit tests run on parallel threads, some spawn processes, and a child that another thread is spawning holds a copy of every descriptor from its fork until its exec closes them. A probe in that window connects, and the observer correctly reads the session as running. That is the failure seen once in CI: Found(Running, Unknown) where Indeterminate(SocketProbe) was expected. registry_support::stale_socket already gives the integration tests a socket that was bound and never listened on for this reason. Replace the dropped listener with one made the same way. The observer is unchanged.
Contributor
Author
|
Independent read GO at exact head Read:
Risks (low): the helper adds an |
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.
This fixes a test-only race behind one failure of
registry::keyed::tests::a_record_naming_no_pid_is_probed_but_never_turned_into_a_loss. It failed in #210's Nix job and passed on rerun. The run gotFound(Running, Unknown)whereIndeterminate(SocketProbe)was expected (keyed.rs:1375).Cause. The test drops its
UnixListenerand expects the next probe to be refused. A dropped listener can still accept connections:registry_support::stale_socketdocuments the same race and already avoids it for the integration tests. It failed 44 runs in 1000 on a Mac on 2026-09-28.Fix. The test now replaces the dropped listener with a socket made the same way as
stale_socket: bound and never listened on. Such a socket refuses every connect, whichever process holds it. The helper also checks that it refuses. The observer is unchanged.Measured on Linux, at main d997dd3 (its pty-core is identical to this branch's base):
Deterministic control. Before the drop, I made another thread spawn
truewith apre_execthat signals and then sleeps 300 ms, so its child holds the copies while the test probes. With that injection, main's test failed 5/5 with the CI symptom:Found(... status: Running, identity: Unknown)at the refusal assertion. This branch's test passed 5/5 under the same injection.Natural rate. Main failed 0/2000 with the test alone, and 0/200 with the whole pty-core lib binary unloaded. Pinned to one core with two spinners, main and this branch ran side by side: the keyed test failed 0/60 on each.
So on this host the window is rare. CI's build sandbox can be much slower to exec.
This branch: pty-core lib, 205 passed.
The one-core runs also caught an unrelated timing flake:
operation::record::tests::an_observed_exit_is_gone_once_the_zombie_shows_within_the_capfailed 1/60 on main. I'm reporting it separately; it isn't touched here.