You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test(ci): apt-retry grace test timed out once — a cleanly exited command waited past the 20 s limit, cause unknown #21384
repo_tests/apt_retry_one_mechanism_21325_test.py::test_a_prompt_capture_costs_none_of_the_grace failed once in CI with
subprocess.TimeoutExpired: Command '['/usr/bin/sh', '.../docker/apt/apt-retry', 'apt-get', 'install', 'x']' timed out after 20 seconds
on a pull request that does not touch docker/apt/apt-retry or its tests (the files are byte-identical to main). The same test passed in the suite runs of the two merge trains that landed after it was added, so the failure is intermittent. One sighting so far.
What the test does: the stub apt-get prints one line and exits 0; APT_RETRY_TEE_GRACE_S=30; the wrapper is run with a 20-second limit; the test asserts the wrapper does not wait out the grace period when the output reader finishes on its own. The stub starts no child process and no attempt is killed, so the 20-second timeout means either the reader never saw end-of-file and the wrapper sat in its 30-second grace, or something kept the wrapper's output pipe open.
The mechanism is NOT established. Reading docker/apt/apt-retry (the fifo and reader section) did not show what could hold the write end open in this case; the shard was slower than its neighbours (545 s vs 422–456 s), so runner load is a possible factor but unproven.
Why it matters beyond the test: the grace wait exists so that a stuck output reader cannot hold an apt step; if the wrapper can spend the whole grace period after a command that already exited cleanly, every wrapped apt call can silently take 30 seconds longer under the same condition.
Acceptance criteria
The cause is established (wrapper race vs test margin vs runner): on timeout the test (or a diagnostic variant) records whether the wrapper reached the grace wait and which process held the pipe.
Root-cause fix: either the wrapper's wait for its output reader is independent of any lingering writer and bounded as intended, or the test's limit and the configured grace are made consistent so the test cannot pass or fail on timing alone.
The test no longer depends on scheduling luck (no single wall-clock limit smaller than a period the code under test may legitimately wait).
Evidence
Failing job: python-suite shard 6/8 of the suite run on PR #21361 at head 4b35cfdeaf (2026-11-12). Parent: #21325.
test_a_prompt_capture_costs_none_of_the_grace timed out again after 20 s, this time in the pre-board guard lane (shard 5 of 6) on a branch that does not touch docker/apt/apt-retry or its tests; it was the only failure among 18988 executed guard tests, and it turned the lane's verdict red. The first sighting was in the regular suite (shard 6 of 8) on another PR. Two different runners, two different shard layouts, same symptom — so this is not a one-off runner hiccup.
Raised to high: with the guard lane meant to gate boarding, a random red here costs a lane run or a full suite each time. The failing shard was rerun with this comment as the justification.
Cause established and independently confirmed (PR #21392, not yet merged): the wrapper stops its watchdog subshell with TERM microseconds after forking it; in dash and busybox ash a freshly forked subshell can still swallow that TERM through the wrapper's own inherited handler, so the watchdog survives, sleeps the whole grace and the wrapper waits for it. Standalone experiments by the author and, separately, by the reviewer: TERM slow in 26–51 of 40–60 runs in dash, 21–30 in busybox ash; KILL slow in 0. The fix stops the watchdog with KILL.
Residual noted by the review, pre-existing and not changed by the PR: if the wrapper is launched with TERM ignored (for example under nohup), the watchdog's TERM to the output reader has no effect either, so a stuck reader would be waited on until the writer closes. Unusual launch; recorded here so it is not lost — to be decided whether the reader stop should also use KILL.
Landed in #21392 via merge train #21394, merge commit 923b9e902e on main, checked 2026-11-12 (Riga).
AC
Status
Evidence / what remains
Cause established
ticked on the issue's own recorded experiments only
The comment records standalone experiments by the author and the reviewer (TERM to a just-forked watchdog subshell slow in 26-51 of 40-60 runs in dash, 21-30 in busybox ash; KILL slow in 0). The failure was NOT observed on a CI runner with the mechanism confirmed there, and the test does not itself record which process held the pipe; it only distinguishes "wrapper had not exited" from "a child holds the pipe" in its failure message.
Root-cause fix
met
docker/apt/apt-retry:179kill -s KILL "$watchdog_pid" (comment lines 176-178 give the reason); line 107 cleanup also KILL. Test apt_retry_one_mechanism_21325_test.py::test_a_prompt_capture_costs_none_of_the_grace_when_term_is_ignored forces the ordering with trap "" TERM
Test no longer depends on scheduling luck (no wall-clock limit smaller than a period the code may legitimately wait)
UNCHECKED
The prompt tests still use a 10 s wall-clock bound (_PROMPT_BOUND_S) against a 30 s grace (_LONG_GRACE_S); the forced-ordering variant makes the old race deterministic, but a stall over 10 s on a loaded runner would still fail it. Judging whether that margin is acceptable is open.
Residual recorded earlier, not an AC and not changed: with TERM ignored on entry the watchdog's kill "$tee_pid" (apt-retry:172, TERM) also has no effect, so a stuck reader is waited on until the writer closes; whether the reader stop should use KILL is undecided. Issue stays open.
Activity
mrveiss commentedon Nov 12, 2026
Second sighting — same day (2026-11-12)
test_a_prompt_capture_costs_none_of_the_gracetimed out again after 20 s, this time in the pre-board guard lane (shard 5 of 6) on a branch that does not touchdocker/apt/apt-retryor its tests; it was the only failure among 18988 executed guard tests, and it turned the lane's verdict red. The first sighting was in the regular suite (shard 6 of 8) on another PR. Two different runners, two different shard layouts, same symptom — so this is not a one-off runner hiccup.Raised to high: with the guard lane meant to gate boarding, a random red here costs a lane run or a full suite each time. The failing shard was rerun with this comment as the justification.
mrveiss commentedon Nov 12, 2026
Cause established and independently confirmed (PR #21392, not yet merged): the wrapper stops its watchdog subshell with TERM microseconds after forking it; in dash and busybox ash a freshly forked subshell can still swallow that TERM through the wrapper's own inherited handler, so the watchdog survives, sleeps the whole grace and the wrapper waits for it. Standalone experiments by the author and, separately, by the reviewer: TERM slow in 26–51 of 40–60 runs in dash, 21–30 in busybox ash; KILL slow in 0. The fix stops the watchdog with KILL.
Residual noted by the review, pre-existing and not changed by the PR: if the wrapper is launched with TERM ignored (for example under
nohup), the watchdog's TERM to the output reader has no effect either, so a stuck reader would be waited on until the writer closes. Unusual launch; recorded here so it is not lost — to be decided whether the reader stop should also use KILL.github-actions commentedon Nov 12, 2026
Landed via the merge train (#21394, merge
923b9e902e) via #21392mrveiss commentedon Nov 12, 2026
Landed in #21392 via merge train #21394, merge commit
923b9e902eon main, checked 2026-11-12 (Riga).docker/apt/apt-retry:179kill -s KILL "$watchdog_pid"(comment lines 176-178 give the reason); line 107 cleanup also KILL. Testapt_retry_one_mechanism_21325_test.py::test_a_prompt_capture_costs_none_of_the_grace_when_term_is_ignoredforces the ordering withtrap "" TERM_PROMPT_BOUND_S) against a 30 s grace (_LONG_GRACE_S); the forced-ordering variant makes the old race deterministic, but a stall over 10 s on a loaded runner would still fail it. Judging whether that margin is acceptable is open.Residual recorded earlier, not an AC and not changed: with TERM ignored on entry the watchdog's
kill "$tee_pid"(apt-retry:172, TERM) also has no effect, so a stuck reader is waited on until the writer closes; whether the reader stop should use KILL is undecided. Issue stays open.fix(ci): stop the apt-retry watchdog with KILL so a prompt capture ne…