Repository navigation
test(reaper): wait for the stub to run its script before reaping - #1781
Merged
Merged
Conversation
test_reaper_kills_an_abandoned_stub failed once on the musl CI leg: the reaper did not list the stub it had just spawned. Popen returns after the first exec (/usr/bin/env from the shebang). env then execs python3, and while that exec is in flight /proc/<pid>/cmdline reads empty, so the argv-based reaper skips the stub. Locally, 67 of 300 reads right after Popen were empty. _spawn_stub now waits for <debug-file>.argv.json, the stub's first write, which proves the exec chain is done. With that wait, 300 of 300 reads saw the stub, and the test passed 40 of 40 runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
[Low impact] The PR appears safe to merge.
|
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.
What
test_reaper_kills_an_abandoned_stubflaked on the musl CI leg on 2026-10-31 (job 124507758854) withAssertionError: assert 22744 in [21406, 21463, 21627]. The reaper did not list the stub that the test had just spawned. The re-run passed.The cause is a race in the test, not a reaper bug.
Popenreturns after the first exec, which is/usr/bin/envfrom the stub's shebang. env then execspython3, and while that exec is in flight,/proc/<pid>/cmdlinereads empty.reap_fixture_stub_straysselects stubs by their argv, so a reap in that window skips the stub. Locally, 67 of 300 reads right afterPopenreturned an empty argv._spawn_stubnow waits, up to 30 s, for<debug-file>.argv.json.run_bridgewrites that file before anything else, which proves that the exec chain is done. If the stub exits or the time runs out, the helper kills it and fails loudly. With the wait, 300 of 300 reads saw the stub, and the test passed 40 of 40 local runs. Onlytests/test_stub_reaper.pychanges.Checklist
no-changeloglabel applied (tests only).just checkpasses locally (7641 passed).🤖 Generated with Claude Code