Repository navigation
test: make process-group timeout test deterministic - #32
Merged
Merged
Conversation
The test raced a child that wrote a sentinel after 1 s against a 1 s timeout. Measured margin on an idle Mac was 33-51 ms, so scheduling jitter on CI runners flipped the result and the required macOS check failed randomly. The child now sleeps 30 s and the parent records its PID. After the timeout the test polls until that PID is gone (5 s deadline) and still asserts no sentinel was written. A broken group kill (killpg failing, only the parent killed) fails the test with 'child survived the group kill'.
Owner
Author
|
macOS CI: 10/10 consecutive passes of |
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.
Fixes the flaky required check V5 Stage C / macOS ARM64, caused by
test_real_subprocess_timeout_kills_child_process_group.Root cause
The test raced a child that writes a sentinel after
sleep(1)against a 1 s timeout. On an idle Mac the child would have written 33–51 ms after the group kill returned (15 measurements), so scheduling jitter on CI runners flipped the result. The runner code (_bounded_subprocess→os.killpg(SIGKILL)on timeout) was correct.Fix
Popen.TimeoutExpired, the test pollsos.kill(pid, 0)until the PID is gone (5 s deadline), then asserts that no sentinel was written.Verification
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 -W error)killpgbroken so only the parent dieschild survived the group killsrc/+verify/test_codex_release_upgrade.py), ruffTest-only change: no regression-gate latency run needed (CLAUDE.md rule 13).