Repository navigation
tools: an ended gate run takes its binary's timeout with it - #201
juliankang4 wants to merge 31 commits into
Conversation
There was a problem hiding this comment.
Verdict: MUST_FIX: Cancellation can leave stack-watch children running.
Must fix
1. Wait again after a signal interrupts child cleanup
tools/ref/stack-watch.sh:58: TERM during the dump interrupts Bash's wait. The new trap forwards TERM, but the wait returns before delayed debugger cleanup finishes. Line 59 clears the dump PID, so the watcher can finish after the watched command exits while the dump's timeout and debugger remain alive.
tools/ref/stack-watch.sh:110: the quiet-command branch breaks out of the loop before waiting for the command. If TERM arrives during that final wait, the new trap also interrupts it: the watcher returns 143 while the command is still shutting down. The trap's signal ignore prevents later interruptions, but does not resume the interrupted wait.
These children inherit the gate's lock descriptors and output writers. Fix both waits in this cancellation change so a completed runner does not leave them held.
Replace the dump wait and PID reset with:
wait "$dump"
wait "$dump"
dump=''Replace the final command wait block with:
rc=0
wait "$pid" || true
wait "$pid" || rc=$?Extend the existing self-test with delayed debugger shutdown and TERM during the final wait. Its current debugger stub uses exec sleep 10, which exits immediately on TERM.
Checked
Evidence: read both waits, the new trap, the quiet-command branch, the cancellation self-test and the GPU caller's lock handling.
Tests: focused Bash probes using the dump function and final-wait block returned with a delayed child still alive. Both replacements waited for shutdown; the final wait preserved exit 7 instead of returning 143.
Gates: stack-watch's existing test expectations are unchanged.
Inline: line 58 is added by the diff; the replacement is valid Bash.
Escape catalog: C1–C4 do not match this finding. No ledger lessons are in force.
Notes
Full self-test suites were not rerun.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
| for t in /proc/"$pid"/task/*; do | ||
| timeout 120 gdb -p "$target" -batch -ex 'thread apply all bt' > >(sed 's/^/stack-watch: /' >&2) 2>&1 & | ||
| dump=$! | ||
| wait "$dump" |
There was a problem hiding this comment.
TERM interrupts this wait before delayed debugger cleanup finishes. Wait again before clearing the dump PID so its timeout and debugger cannot outlive the watcher.
| wait "$dump" | |
| wait "$dump" | |
| wait "$dump" |
8d11239 to
ddc585c
Compare
|
Fixed in The same path had one more gap, fixed in the same commit. A signal that came outside a wait (during the loop's sleep) left the loop running, and when the command took longer than the quiet time to end after its TERM, the watch started a dump that no signal would reach. The trap now sets After a signal, the watch waits for the dump and the command only as long as their own bounds allow (the dump's 120 s and the command's own The self-test has the two cases the review asked for, and a third:
Results:
|
There was a problem hiding this comment.
Verdict: MUST_FIX: both supervisors can exit between child launch and trap installation, leaving the bounded command alive.
Must fix
1. Install forwarding traps before launching either child
tools/gate-bound.sh:40 and tools/ref/stack-watch.sh:83: TERM after the background launch and before the trap kills the runner alone. Its timeout and binary retain inherited output descriptors and gate or lease locks until their own bound.
Focused launch-sequence probes delivered TERM before PID assignment in both supervisors: the runner terminated by TERM and its timeout stayed alive. The replacements below awaited the child before returning.
Cost: close this window while changing the signal owner; otherwise cancellation still leaves later runs waiting.
Replace run_bounded with:
run_bounded() {
local traps s rc=0 BIN_PID=''
traps=$(trap -p TERM INT HUP)
BIN_SIGNAL=
for s in TERM INT HUP; do
# shellcheck disable=SC2064 # bind the signal now, read the pid in the trap
trap "BIN_SIGNAL=$s
if [ -n \"\$BIN_PID\" ]; then
trap '' TERM INT HUP
kill -TERM \"\$BIN_PID\" 2> /dev/null
fi" "$s"
done
"$@" <&0 &
BIN_PID=$!
if [ -n "$BIN_SIGNAL" ]; then
trap '' TERM INT HUP
kill -TERM "$BIN_PID" 2> /dev/null
fi
wait "$BIN_PID" || true
wait "$BIN_PID" || rc=$?
trap - TERM INT HUP
eval "$traps"
return "$rc"
}In watch, replace the child launch and current trap at lines 77–83 with:
pid=
trap 'stop=1; if [ -n "$pid" ]; then
trap "" TERM INT HUP
kill -TERM "$pid" ${dump:+"$dump"} 2> /dev/null
fi' TERM INT HUP
"$@" > "$log" 2>&1 &
pid=$!
if [ "$stop" = 1 ]; then
trap '' TERM INT HUP
kill -TERM "$pid" 2> /dev/null
fiBefore the PID exists, these traps record the signal without ignoring it. After assignment, they forward the pending signal. Add a regression case that sends TERM at that boundary and asserts that the child is gone and the lock is free.
Checked
Duplicates: one finding covers the launch window in both supervisors. The watch also owns dump cancellation.
Complexity: no Rust functions changed; shell launch, trap and wait transitions reviewed.
Silent failure: the second waits retain command status; lease_bounded replays BIN_SIGNAL after restoring the caller's traps.
Tests: focused validator probes reproduced both launch-window failures and checked the replacements. The run_bounded replacement preserved child codes 0, 7 and 101. The added self-tests send TERM after child startup, so they miss this boundary.
Gates: the dump-case time window has a dated PIN and reason; no engine gates moved.
Escape catalog: no C1–C4 pattern matched.
Notes
Full self-tests were not rerun by the validator.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
Filed outside this PR: #212
ddc585c to
572ee7b
Compare
|
Fixed as suggested in About the regression case: the window lies between two shell commands, the A second look at the same paths found more of the same kind, fixed here:
The t0 failure on Results at the head are under "What I ran" in the PR body: the self-tests pass on the Mac (bash 5 and bash 3.2) and on a DGX Spark, and of the 167 affected gate runs on a DGX Spark, 30 pass and the other 137 fail the same way on main. |
There was a problem hiding this comment.
Verdict: MUST_FIX: TERM to a timing runner's PID still leaves its captured command and the machine lease alive.
Must fix
1. Close the cancellation defect in capture callers (kind A)
tools/ref/lease.sh:469 runs in a command-substitution subshell at tools/ref/ab-decode.sh:58 and tools/ref/depth-gpu.sh:132. TERM to the runner PID ends that shell without reaching the subshell's forwarding trap. The command and timeout retain descriptor 9, blocking subsequent timing runs until the arm bound (900 seconds by default). An independent reproduction confirmed both processes and the lease survive the runner.
Fixing the capture callers now avoids a second cancellation fix and another round of lease tests. The new termination tests call lease_bounded directly and miss this path.
Call lease_bounded in the runner shell and capture its output in a file. Apply this to substitution and pipeline callers. Replace ab-decode.sh:58 with:
arm_log=$(mktemp) || exit 70
trap 'rm -f "$arm_log"' EXIT
lease_bounded "$LEASE_ARM_BOUND" env ${e_args[@]+"${e_args[@]}"} \
"$(decode_bin "$d")" -m "$MODEL" --tokens "$TOKENS" -n "$N" \
>"$arm_log" 2>&1
rc=$?
out=$(cat "$arm_log") || exit 74
rm -f "$arm_log"
trap - EXIT
if [ "$rc" -ne 0 ]; then
echo "r$r $label FAILED" >&2
printf '%s\n' "$out" | tail -n 5 >&2
exit 1
fiPreserve existing cleanup traps in other runners. Extend the lease termination test to capture output and send TERM to the runner PID; assert that the command and timeout end and the lease is free.
Checked
Evidence: read both capture callers, descriptor 9's acquisition, and the changed signal handler.
Verification: with the changed functions, a PID-only TERM left the captured command, timeout and lock alive; the direct-call control ended both children and freed the lock. The proposed replacement passes bash -n.
Test coverage: the new termination cases use direct calls; the captured stdin case sends no signal.
Gates: the stack-watch dump timing window has a dated PIN and a reason. Escape catalog C1–C4 does not match this finding. No ledger lessons are in force.
Notes
The PR reports contrib-check t1 failures with uutils timeout; run_bounded returns the timeout child's status and documents GNU timeout behavior.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
Filed outside this PR: #221
572ee7b to
bbfa52b
Compare
|
Fixed in bbfa52b, the head now on the branch:
The PR body has the results at this head. AI helpAI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다. |
There was a problem hiding this comment.
Verdict: MUST_FIX: Cancelling the profiling runner still leaves its decoder holding the timing lease.
Must fix
1. Stop the profiling runner's decoder on cancellation
tools/ref/perf-decode.sh:31 starts the decoder under a separate background timeout. TERM during perf record stops the profiling child, then tools/ref/lease.sh:488 signals the runner again and terminates it. The decoder and its timeout survive with lease descriptor 9 until their bound (900 seconds by default). A focused cancellation probe confirmed both survivors and the held lease. This is a kind A behavior defect.
This is a remaining sibling of the cancellation defect this PR fixes. Closing it now prevents the profiling runner from retaining the same lease leak.
Replace the decoder launch and bound_pid=$! with:
bound_pid='' decode_exit=''
trap 'trap "" TERM INT HUP; [ -z "$bound_pid" ] || { kill -TERM "$bound_pid" 2>/dev/null || :; wait "$bound_pid" 2>/dev/null || :; }' EXIT
for s in TERM:143 INT:130 HUP:129; do
trap "decode_exit=${s#*:}; [ -z \"\$bound_pid\" ] || exit ${s#*:}" "${s%:*}"
done
timeout --kill-after=10 "$LEASE_ARM_BOUND" "$BIN" -m "$MODEL" --tokens "$TOKENS" -n "$N" > "$OUT/decode.log" 2>&1 &
bound_pid=$!
[ -z "$decode_exit" ] || exit "$decode_exit"Replace the later wait "$bound_pid" with:
decode_rc=0
wait "$bound_pid" || decode_rc=$?
bound_pid=''
[ "$decode_rc" -eq 0 ] || exit "$decode_rc"The cleanup passed the focused probe: exit 143, both children gone, lease free. Add a regression that cancels during profiling and checks both children and the lease.
Checked
Scope: the decoder launch is unchanged, but the fix-PR sibling-path exception applies to this cancellation defect.
Duplicates and complexity: no finding retained in either category.
Silent failure: traced cancellation through run_bounded, lease_bounded and inherited lease descriptor 9.
Tests: the focused probe reproduced the failure and verified the proposed cleanup with executable stubs.
Gates: no gate change requested by this finding.
Escape catalog: C1–C4 do not describe this finding.
Notes
Full shell self-tests and GPU gates were not rerun during validation.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
GNU timeout runs its command in a process group of its own, and the gate runners ran their binary under timeout in the foreground. A TERM, INT or HUP sent to a runner's group never reached the binary's timeout, and a TERM sent to the runner's pid ended the runner alone. Either way the binary ran on until its own bound and kept what it held: gpu-gate.sh's gate locks and the run's output, time-gate.sh's machine-wide lease, host-gate.sh's and gate.sh's output. The gpu-gate self-test met it whenever gate()'s 60 s bound ended a held run: a later blocking flock and relay() waited on what was left. run_bounded, in gate-bound.sh beside the bound's parser, starts the bounded command as a child and waits for it. A TERM or HUP (and an INT where the runner hears one) goes on to the child as a TERM; the trap then ignores further signals, so the runner returns after the child, with its code. gpu-gate.sh's three start paths, host-gate.sh, gate.sh and time-gate.sh all run through it. gate.sh with a test filter feeds tee through a FIFO, since a pipeline would run run_bounded in a subshell a TERM to the runner does not reach. lease.sh's lease_bounded, which bounds the children of the timing runners under the lease, runs through it as well and then stops the runner on the signal it passed on, by the runner's own trap where it set one; run_bounded gives the caller its traps back. stack-watch.sh passes a TERM or HUP on to its command and to a gdb dump under way; the dump runs in the background and is waited for, so a TERM during it is heard at once. The Mac's stand-in timeout keeps coreutils' timing and codes: TERM at its bound or on a TERM it receives, KILL --kill-after seconds after the first (none at 0), 124 when the bound ran out and 137 after the KILL. The gpu-gate self-test ends a held run by gate()'s own bound (GB=<s>, 10 here), plain and under the watch: right after the bound returns 124 the stub and its timeout are gone and the card lock is free, then the output ends, and the runner's code is the stub's 7 (STUB_TERM). The stack-watch self-test sends two TERMs during a dump by a stub gdb that holds; card-tests run gate.sh's filter path. The lease self-test sends a TERM to a runner that holds a temp lease and runs a stub under lease_bounded, with and without a TERM trap of its own: the stub and its timeout are gone, the lease is free and the runner's next arm never starts.
…and starts no dump after it (review) The watch's trap passes a TERM, INT or HUP on and then ignores further signals, but the signal itself cuts short the wait it arrives in. During a dump, the watch went on while the debugger and its timeout were still shutting down, and cleared $dump; in the last wait for the command, it returned 143 while the command was still ending. Both kept the gate's lock descriptors and output writers open after the runner had gone on. Each wait is now made twice, as run_bounded does: the trap ignores later signals, so the second wait is not cut short and reads the child's status. The first waits take || true, so a watch run under errexit still reaches the second. A signal that came outside a wait, during the loop's sleep, left the loop running: when the command took longer than QUIET to end after its TERM, the watch dumped its quiet process with a gdb no signal would reach, and waited for it up to the dump's 120 s bound. The trap now sets $stop; the loop ends on it and starts no dump, and a dump started as the signal came gets a TERM as well. The self-test's stub gdb now holds in a loop and ends six seconds after its TERM, so the dump case allows 19 s (PIN). A second new case sends a TERM while the watch waits for a command that goes on after its quiet process was ended, and a third sends a TERM before the quiet time to a command that takes five seconds to end. With single waits the first two fail (the gdb left; 143 with the command left); with the waits made twice but no $stop the third fails (a dump after the TERM). Now all three end with the command's code 7, nothing left and no dump after the TERM.
…arts (review) Both started the child with & and set the forwarding trap after reading its pid. A TERM that came in between ended the runner by the default action, and the child (timeout and the binary under it) ran on with the runner's lock descriptors and output writers until its own bound. The trap is now set first. Before the pid is known it only records the signal (BIN_SIGNAL in run_bounded, $stop in the watch) and ignores nothing, so the child does not start with the signals ignored; once the pid is read, a recorded signal is passed on as a TERM, and from then on the trap passes on and ignores later ones, as before. run_bounded's BIN_PID is a local set empty before the trap, so a pid from an earlier call is never signalled, and the watch's pid starts empty, which its trap reads under set -u. stub-timeout.py, the stand-in timeout on hosts without one, sets its TERM handler before it starts COMMAND, so a TERM forwarded right after the launch reaches COMMAND instead of ending the stand-in alone. A second TERM sends COMMAND another TERM and moves no deadline, as GNU timeout does. The lease_bounded self-test's stub now sets its trap before it writes its pid, and the test sends the TERM as soon as the pid is there (polled every 0.1 s). stack-watch's self-test gains a case that sends the TERM right after the command has started: the command sets its trap, writes its pid and holds, and the watch returns with its code 7 and nothing left. Neither case reaches the window between the start and the trap: it lies between two shell commands, and the runner has read the pid by the time the test sees it, so both cases pass with the old order too. Only a delay planted in that window tells the two orders apart.
…ase prints its last line After the dump the watch TERMs the quiet process and gives it ten seconds before a KILL, polling with kill -0. kill -0 succeeds on a zombie, so a process that had ended but was not yet reaped held the watch for the full ten seconds and then took a KILL it could not feel. That happens when its parent does not reap it, and when an orphaned one is reparented to a subreaper that does not reap. The poll and the KILL now read the state from ps -o stat= (BSD and procps alike): gone, or Z, is ended. A failed self-test case now carries the last line of what it read on its FAIL line (the observed summary, such as "dumping: yes, ended in N s, left: none"), so a log that keeps only FAIL lines still shows why. No case's verdict changes.
…run_bounded's trap (review) With a test filter gate.sh starts tee on the FIFO first and only then calls run_bounded, which sets its trap. A TERM to the runner's pid in between ended the runner by the default action, and tee, still waiting to open the FIFO, held the runner's output open, so a reader of that output never saw its end. gate.sh now sets a TERM, INT and HUP trap before tee starts: once tee's pid is known the trap exits (143, 130, 129) and the EXIT trap ends tee and removes the log and the FIFO; a signal that comes before tee's pid is known is held and acted on as soon as it is. run_bounded puts this trap back when it returns. tee's pid is cleared once it is reaped, so the EXIT trap never signals a pid that was reused.
…mp with it ignored, and go on when a TERM finds its child ended (review) Once it has passed a signal on, the watch's trap ignores further ones. A signal that came after the check before a dump and before the dump started set that ignore, and the dump (timeout and gdb) started with TERM ignored: the TERM the watch then sent it could land before timeout set its own handler and be lost, and the gdb ran on to the dump's bound. The trap now ignores nothing while a child may still start ($spawning: from that check until the dump's pid is known, as before the command's pid is known); a signal in that window is passed on to the command, and the dump gets its TERM as soon as its pid is. A signal that came after a child's pid was read and before the check of a held signal was passed on twice, by the trap and by the check. The trap now records that it has passed it on (BIN_SENT in run_bounded, $told in the watch, the pids it sent to), and the check sends only when it has not. A cleanup TERM to a child that had already ended (bash reaps a background child as it ends) failed, and under set -e that ended the caller before its last waits. Each such kill now ends `|| :`, and the KILL after a dump is an if. run_bounded clears its pid and the watch its $pid once the child is reaped, so a signal after that reaches no other process. The dump's output went through `> >(sed ...)`, a child of its own that the two waits for the dump do not wait for, and that could outlive the watch holding its output. The dump now writes to a file beside the watch's log, and the watch passes the file to stderr, prefixed, once the dump has ended. The dump's timeout gets --kill-after=10, so a gdb that ignores the TERM at 120 s is killed ten seconds later instead of holding the watch.
…set, and its TERM-before-quiet case prints until the TERM (review) The stub gdb wrote its pid, which the dump case waits for, before it set its TERM trap; a TERM sent in between ended it at once, without the delayed exit the case is there to test. It now sets the trap first, as the commands of the other cases do. The case with a TERM before the quiet time slept 0.5 s after the command's pid and relied on the TERM coming before the 2 s quiet time ran out; on a slow host the watch could dump first. Its command now prints every 0.2 s until the TERM and stops printing then, so only the TERM, whenever it comes, lets the quiet time run out. The case named "a TERM as the command starts" sends its TERM once the command has written its pid, when the watch has read the pid already; it is renamed "a TERM right after the command has started", in the self-test and in check-recipes.sh's summary.
…m a file (review)
Run the DS41 and GLM5Next preheats and the C-state A/B arms through lease_capture. Keep their output and return-code handling while cancellation ends the child before the runner releases its lease. Exercise both preheaters and the C-state arm loop under a TERM to the runner, with and without its own TERM trap.
A held command can publish its PID before GNU timeout returns from fork. A TERM in that interval ends timeout without signalling the command, so the runner is reaped while the stub still holds the lease. Wait for the timeout parent to be sleeping with the held command alive before sending TERM, and check readiness in each runner form. The bound, return codes, caller traps and assertions on surviving processes and lease release stay the same, including the runner's own startup gap.
… lease Own the background decoder's timeout with an EXIT trap and defer signals until its PID is known. Reap and clear it on normal completion, retaining the decoder's status and the later profiling commands' signal handling. The lease self-test cancels perf record once both timeout monitors are waiting and checks that both command trees end and the lease is free.
Send TERM to timeout and its process group through lease_stop, wait for live members and reap the monitor. Escalate to KILL after ten seconds so a command left in timeout's fork window cannot keep the lease. Load groups defer signals until their monitor is known. Memory scopes ignore repeated signals and wait again for the command's status. perf-decode reports decoder failures with the last twenty log lines. Exercise load groups, the orphaned timeout group, the real memory scope and perf cancellation before spawn and during annotate and callers.
Share lease_stop through gate-bound.sh without loading timing runners from gates. Parse process rows with an explicit IFS so cancelling a FIFO read waits for orphaned timeout children.
…ommand for BSD awk
Run the watched command and stack dump through run_bounded so cancellation waits for the monitor group and releases inherited locks. Cover fork-exit monitors in the watcher self-test and signals around tee PID publication in the card cases. Describe process-table failure cleanup and print perf stderr when readiness fails.
The FIFO reader can still be a shell setting up tee when cancellation arrives. A catchable TERM without a wait does not guarantee that reader has ended. Kill the remaining reader and reap it before cleanup returns, while ignoring further cancellation signals.
bbfa52b to
dd64d46
Compare
|
Fixed in dd64d46, the head now on the branch:
The review listed no other items. The PR body has the results at this head. AI helpAI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다. |
There was a problem hiding this comment.
Verdict: MUST_FIX: cleanup errors can produce a successful gate status, and the new cancellation fixtures duplicate one fact.
Must fix
1. Preserve cleanup errors in the gate status
tools/gate-bound.sh:93 Both cleanup calls discard lease_stop's failure. A TERM followed by a child exiting 0 therefore returns 0 even when process-table inspection fails with 70. A probe using ps() { sleep 0.1; return 1; } reproduces this.
Fixing the shared runner prevents every gate caller from accepting this cleanup failure. Preserve the error in rc; a later nonzero child status still fails the gate:
run_bounded() {
local traps s rc=0 BIN_PID='' BIN_SENT=''
traps=$(trap -p TERM INT HUP)
# shellcheck disable=SC2034 # the caller reads it
BIN_SIGNAL=
for s in TERM INT HUP; do
# shellcheck disable=SC2064 # the signal's name now, the pid when the trap runs
trap "BIN_SIGNAL=$s; [ -z \"\$BIN_PID\" ] || { trap '' TERM INT HUP; BIN_SENT=1; lease_stop \"\$BIN_PID\" || rc=\$?; }" "$s"
done
"$@" <&0 &
BIN_PID=$!
if [ -n "$BIN_SIGNAL" ]; then
trap '' TERM INT HUP
[ -n "$BIN_SENT" ] || lease_stop "$BIN_PID" || rc=$?
fi
wait "$BIN_PID" || true
wait "$BIN_PID" || rc=$?
BIN_PID=''
trap - TERM INT HUP
eval "$traps"
return "$rc"
}2. Share the fork-race fixtures (R14)
tools/ref/lease.sh:1314 and tools/ref/stack-watch.sh:256 embed the identical Python timeout. Their bounded_ready and fork_ready helpers also encode the same readiness predicate.
Each change to the simulated fork race now needs two edits. Sharing these fixtures removes more code than it adds.
Put these helpers in tools/ref/cancel-stubs.sh:
cancel_timeout() {
cat > "$1" <<'PY'
#!/usr/bin/env python3
import os
import signal
import subprocess
import sys
os.setpgid(0, 0)
signal.signal(signal.SIGTERM, lambda *_: sys.exit(143))
args = [a for a in sys.argv[1:] if not a.startswith('--kill-after=')]
child = subprocess.Popen(args[1:], close_fds=False)
try:
rc = child.wait(timeout=float(args[0]))
except subprocess.TimeoutExpired:
child.kill()
child.wait()
rc = 124
sys.exit(128 - rc if rc < 0 else rc)
PY
}
cancel_ready() {
local sp ip state
[ -s "$1" ] && read -r sp ip < "$1" || return 1
state=$(ps -o stat= -p "$ip" 2> /dev/null) || return 1
case $state in *S*) return 0 ;; esac
return 1
}Source that file inside each self-test: source "$LEASE_TREE/tools/ref/cancel-stubs.sh" in lease.sh and source "${self%/*}/cancel-stubs.sh" in stack-watch.sh. Replace both timeout heredocs with cancel_timeout "$t/fork-bin/timeout". Delete bounded_ready/fork_ready and rename their calls to cancel_ready. Keep the existing chmod calls.
Checked
- Duplicates: the two timeout heredocs are identical; the readiness predicates are identical after excluding comments.
- Complexity: no Rust functions changed; run_bounded's signal and cleanup transitions inspected.
- Silent failure: both discarded lease_stop statuses reach run_bounded's result, which the gate runners use as their exit status.
- Tests: 27 changed shell scripts and the Python timeout stub pass syntax checks. With a failed process read and a child exiting 0 after TERM, the cancellation probe returns 0 at the head and 70 with the fix. A child status of 7 remains 7. Both inline replacements match the full fix and target added lines.
- Gates: the dump timing case carries a dated PIN.
- Escape catalog: neither retained finding needs an exception to the review exclusions.
Notes
Dryer and crapper did not run because no Rust file changed. Full self-tests were not rerun here.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
| BIN_SIGNAL= | ||
| for s in TERM INT HUP; do | ||
| # shellcheck disable=SC2064 # the signal's name now, the pid when the trap runs | ||
| trap "BIN_SIGNAL=$s; [ -z \"\$BIN_PID\" ] || { trap '' TERM INT HUP; BIN_SENT=1; lease_stop \"\$BIN_PID\" || :; }" "$s" |
There was a problem hiding this comment.
Preserve cleanup failure so a child exiting 0 cannot make the gate pass after lease_stop fails.
| trap "BIN_SIGNAL=$s; [ -z \"\$BIN_PID\" ] || { trap '' TERM INT HUP; BIN_SENT=1; lease_stop \"\$BIN_PID\" || :; }" "$s" | |
| trap "BIN_SIGNAL=$s; [ -z \"\$BIN_PID\" ] || { trap '' TERM INT HUP; BIN_SENT=1; lease_stop \"\$BIN_PID\" || rc=\$?; }" "$s" |
| BIN_PID=$! | ||
| if [ -n "$BIN_SIGNAL" ]; then | ||
| trap '' TERM INT HUP | ||
| [ -n "$BIN_SENT" ] || lease_stop "$BIN_PID" || : |
There was a problem hiding this comment.
Preserve cleanup failure when cancellation arrives before the child PID is recorded.
| [ -n "$BIN_SENT" ] || lease_stop "$BIN_PID" || : | |
| [ -n "$BIN_SENT" ] || lease_stop "$BIN_PID" || rc=$? |
|
Superseded by a new pull request from the same branch; the link follows. |
|
Superseded by #319. |
What and why
Closes #171.
Release notes: internal: a gate or timing runner that is stopped with TERM, INT or HUP now ends the binary it started, so the binary's gate locks, output and timing lease go with the runner instead of staying held until the binary's own bound.
GNU
timeoutputs its command in a process group of its own, and the gate runners start their binary undertimeoutin the foreground. A TERM, INT or HUP sent to a runner's process group never reaches the binary or itstimeout, and a TERM sent to the runner's pid ends the runner alone. Either way the binary runs on until its own bound and keeps what it holds:tools/gpu-gate.sh: the gate lock descriptors and the writers of the run's output, up to 900 s whenBLOOMERY_GATE_BOUNDis unset.tools/ref/time-gate.sh: the machine-wide lease, up to 600 s.tools/host-gate.shandtools/gate.sh: the binary, orcargo test, still writing to the run's output.tools/ref/lease.sh'slease_bounded, which bounds the children the timing runners start under the lease: the lease (descriptor 9), up toLEASE_ARM_BOUND(900 s by default). Most timing runners also call it inside a command substitution or a pipeline (out=$(lease_bounded …)), where even a fix insidelease_boundedwould not see a TERM sent to the runner's pid. The DS41 and Qwen3-MoE depth runners start their arms under atimeoutof their own, piped into a fault marker. The DS41 and GLM5Next preheats andtools/ref/cstate-ab.sh's arms start theirs inside a command substitution (out=$(timeout … 2>&1)).tools/ref/perf-decode.shandtools/ref/load-groups.sh, which start the decoder or the load under atimeoutof their own in the background and give the runner no way to stop it: the lease, up to thattimeout's bound.The gpu-gate self-test meets this when
gate()'s bound ends a held run. The bound returns 124, but the stub binary and itstimeoutstay alive, and a later blockingflockon the same lock, or arelay()reading that output, waits for them.The issue offers two fixes. This PR takes the first: the runner passes the signal on to the inner
timeoutand its process group, and waits for them.run_boundednow lives intools/gate-bound.sh, which gpu-gate.sh, host-gate.sh and gate.sh already source. It sets its trap first, then starts the bounded command in the background and waits for it. A signal that comes before the child's pid is known is recorded and passed on as soon as the pid is, so no signal falls between the start and the trap.BIN_SENTrecords that the trap has passed the signal on already, so the child gets it once. The trap ignores nothing before the child starts, because a child started with signals ignored would keep them. On TERM or HUP it stops that child withlease_stop, ignores further signals and waits until the child ends; the runner then goes on with the child's code. Stopping a child that has already ended is no error, underset -etoo (time-gate.shand the timing runners run under it), and the pid is cleared once the child is reaped, so a late signal reaches no other process. INT works the same way unless the runner itself was started with&by a shell, because bash leaves INT ignored in that case. The child keeps the runner's stdin (<&0), because a background command in a non-interactive shell reads/dev/nullotherwise.lease_stop <pid>, also intools/gate-bound.sh, sends TERM totimeoutand to its process group, waits up to 10 s for the group's live members (a zombie counts as ended), then sends KILL and waits up to 10 s more, and reapstimeout. A group still alive after that is reported ([bound] <pid> or its process group still alive 10 s after KILL) andlease_stopreturns 70, as it does when it cannot read the process table. The TERM goes to the group too because GNUtimeoutthat receives a TERM before it has returned fromforkexits without signalling its command, and the command then keeps the lease or the lock intimeout's group.run_bounded: gpu-gate.sh's three start paths (plain,BLOOMERY_GATE_STACKSandBLOOMERY_GATE_GDB), host-gate.sh, gate.sh, time-gate.sh and lease.sh'slease_bounded. lease.sh now sourcesgate-bound.shbesidelease-probe.sh, and time-gate.sh getsrun_boundedthrough lease.sh and keeps its own 600 s bound.lease_boundedsends the signal it passed on to the runner again (kill -s <signal> $$), and the runner stops, by its own trap where it set one, instead of starting its next arm. For that,run_boundedrecords the signal it passed on inBIN_SIGNALand puts back the caller's own TERM, INT and HUP traps when it returns, instead of resetting them.dump.shanddump-mtp.shsetexit 143andexit 130traps before they calllease_bounded, and a reset would drop them. The gate runners other than gate.sh set no such traps and ignoreBIN_SIGNAL, so for them nothing changes.run_bounded. lease.sh has three helpers for this:lease_capture <seconds> <command…>runslease_boundedwith stdout and stderr in a temp file and puts them inLEASE_OUT, as$(… 2>&1)gave them.lease_filter <seconds> <stdout|stderr> <file> <filter…> -- <command…>runs a live filter (the depth runners'majflt_mark, dma-dram-share.sh'sstamp) on the command's output through a FIFO:stdoutfilters the combined output,stderrfilters stderr and leaves stdout inLEASE_OUT_FILE. The filter runs with descriptor 9 closed, so it never holds the lease. The bound and the arguments are checked before the filter starts. Likerun_bounded,lease_filtersets its trap before it starts the filter, and a signal that comes before the filter's pid is known is acted on as soon as it is: the trap ends and reaps the filter, puts back the caller's traps and sends the signal on to the runner. Without that, a filter still waiting to open the FIFO would outlive the runner and hold the runner's stderr open. When the command succeeds and the filter fails,lease_filterreturns the filter's code.lease_out_initmakes the temp dir with that file and FIFO, and addslease_out_cleanto the runner's EXIT trap without replacing what is there.lease_boundedalso takesLEASE_BOUNDED_OUTandLEASE_BOUNDED_ERR, for a caller that names its own files.lease_capture; perf-decode.sh's three readers and governor-ab.sh's ik arm, whose stderr was dropped, write to files throughLEASE_BOUNDED_OUT. depth-glm5next.sh'soursarms, depth-ds41.sh's and depth-qwen3moe.sh's reference arms, depth-ds41.sh'soursarm and dma-dram-share.sh's bench go throughlease_filter, and depth-qwen3moe.sh'soursarms throughlease_capture. The DS41 and Qwen3-MoE arms keep their$BOUND. The DS41 and GLM5Next preheats and cstate-ab.sh's arms take their output throughlease_capturewith the bound they had ($BOUND, and 600 s in cstate-ab.sh). qdot-rate.sh runs its rounds in its own shell into the sitting file and prints the file after them, and expert-union-dump.sh reads its prompts from a process substitution instead of a pipe into its loop.timeoutand its group withlease_stop, and a TERM, INT or HUP that comes before the decoder's pid is known is held and acted on as soon as it is (exit 143, 130 or 129). Before, a TERM duringperf recordended the profiler and then the runner, and the decoder and itstimeoutkept the lease. After a normal run the runner reaps the decoder and clears its pid, so the laterperf script,annotateandreportcalls keep their usual signal handling. A decoder that fails now fails the run with its code, a reason (cut off at its <n> s boundfor 124) and the last 20 lines of its log. Its symbol table'sawknow writes to("sort -rn | head -n " top)in parentheses, which BSDawkon the Mac needs.lg_processruns a load of arms under onetimeoutin the background. It now sets a TERM, INT and HUP trap before it starts thattimeout: the trap stops the load withlease_stop, puts back the caller's traps and sends the signal on to the runner, and a signal that comes before the load's pid is known is acted on as soon as it is. Its own stops (no line within the bound, a line past the last arm) also go throughlease_stop. depth-qwen3moe.sh's memory scope (MEM_SCOPE_SCRIPT) passes a TERM, INT or HUP on to its command once, ignores further ones and waits again, so it returns the command's code; it used to stop waiting at the first signal.PIPESTATUS[0]. expert-union-dump.sh now stops with code 1 at the first failed prompt; itsexit 1used to end only the pipeline's subshell, and the script went on. dma-dram-share.sh now refuses a value with a leading zero (0600) with 64, aslease_boundedrefuses such a bound; it used to refuse only0.depth-*-stub.shtests build temp trees with a copy of lease.sh; those trees now gettools/gate-bound.shtoo. The lease self-test reads depth-qwen3moe.sh's arms through a variable path, so check-recipes' walk of the timing scripts does not count lease.sh as a caller of that lease-taking runner.cargo testintotee. In a pipeline,run_boundedwould run in a subshell that a TERM to the runner does not reach. The output now reachesteethrough a FIFO beside the log, and the runner waits forteebefore it counts the passed tests. A FIFO that cannot be made ends the runner with 70 before cargo starts.teestarts beforerun_boundedsets its trap, so gate.sh sets a TERM, INT and HUP trap of its own before it startstee: oncetee's pid is known the trap exits (143, 130 or 129), and a signal that comes before that pid is known is acted on as soon as it is. The EXIT trap then ignores further signals, sendsteea KILL and reaps it before it removes the log and the FIFO, because the reader may still be the shell opening the FIFO, beforeteehas its default signal handlers. Without this, a TERM in that window ended the runner, andtee, still waiting to open the FIFO, held the runner's output open.tools/ref/stack-watch.shpasses a TERM or HUP on to its command and to a gdb dump under way. It now sourcesgate-bound.shand runs both the command and the dump throughrun_bounded, so a cancelled watch waits for eachtimeout's group, and a lock either child inherited is free when the watch returns. The dump runs in the background and is waited for. Before, a TERM that came during a dump was handled only after the dump, and an outer KILL in that window left the innertimeoutand the binary behind. Once it has passed a signal on, the trap ignores further ones, because under GNUtimeoutthe watch gets the bound's TERM twice (from the outertimeout's group signal and from the runner). The first signal still cuts short the wait it arrives in, so the watch makes each wait, for the dump and for the command, twice, asrun_boundeddoes: it goes on only after the child has ended, and returns the command's code. The first wait of each pair is writtenwait ... || true, and each TERM the watch sends to a child that may have ended is written|| :, so a watch run underbash -estill reaches its last waits. The trap also sets$stop. A signal that comes outside a wait (during the loop's one-second sleep) ends the loop at its next turn, and the watch then waits for the command and starts no dump. Without it, a command that took longer than QUIET to end after its TERM was dumped with a gdb that no signal would reach. As inrun_bounded, the trap is set before the command starts: a signal before the command's pid is known sets$stop, and the command gets its TERM as soon as the pid is known, unless the trap has sent it one already ($told). The trap also ignores nothing from the last$stopcheck before a dump until the dump's pid is known ($spawning), because a dump started with TERM ignored can lose the TERM the watch sends it beforetimeoutsets its own handler. A signal in that window goes on to the command, and the dump gets its TERM as soon as its pid is known. The dump writes to a file beside the watch's log, and the watch passes that file to stderr, prefixed, once the dump has ended, so no child of the dump outlives it. The dump'stimeoutsends a TERM at 120 s and, with--kill-after=10, a KILL ten seconds later. After a dump the watch gives the quiet process ten seconds to end before a KILL. It reads the process state withps -o stat=and counts a zombie as ended;kill -0succeeds on a zombie, so a process whose parent, or the subreaper it was reparented to, does not reap it held the watch for the full ten seconds. An INT reaches the watch's trap only when the watch runs in the foreground; gpu-gate.sh starts it with&and passes its own INT on as a TERM.tools/ref/stub-timeout.pystands in fortimeouton hosts without coreutils (the Mac). It now keeps coreutils' timing and exit codes. It sends TERM at its bound or when it receives a TERM. It sends KILL--kill-afterseconds after the first of the two, and--kill-after=0means no KILL. It exits 124 when the bound ran out and 137 when the KILL ended the command. It sets its TERM handler before it starts the command, so a TERM that comes right after the runner starts it reaches the command. It still makes no process group: only its direct child is signalled. Before, it sent KILL at once at its bound, and no trap can catch KILL, so the regression below could not pass on the Mac with the old stand-in.The second option in the issue keeps both bounds in one process group. The simplest way to do that is
timeout --foregroundon the inner bound, and in that modetimeoutdoes not end the command's own children when the bound expires. So I did not use it.The tests:
gate()takesGB=<s>for its own bound (the default stays 60 s). The stub writes its pid and its parent's pid (the binary'stimeout) toSTUB_PID. WithSTUB_TERM=7it ends with code 7 one second after a TERM. The case holds the stub and letsgate()'s bound end the run withGB=10, once plain and once under the watch. Right after the bound returns 124 it checks that the stub and itstimeoutare gone and the card lock is free. Then it checks that the output pipe reached EOF and that the runner's own exit line saysexit 7. The processes are checked before the wait for EOF, so a runner that passes the TERM on and exits without waiting does not pass. The exit line catches a runner that returns the status of its interrupted wait (143) instead of the child's.gdbon PATH holds, so the watch (QUIET 1) stays in its dump, and the stub ends only six seconds after its TERM; it sets its TERM trap before it writes the pid the case waits for. The case sends a TERM to the watch and a second one 1.5 s later. The watch must end within 20 s with the command's code (7, two seconds after its TERM), and neither the gdb nor the command may be left. In the second, the command goes on after the watch has ended its quietsleep, and the case sends a TERM while the watch waits for the command. The watch must end with the command's 7, not 143, and the command must be gone. In the third, the command prints every 0.2 s until its TERM and then takes five seconds to end, longer than the quiet time (2 s), and the case sends the TERM a second after the command's pid is there. Its printing, not the TERM's timing, keeps the quiet time from running out before the TERM. No dump may start (the stub gdb writes its pid when it starts), the watch must return 4 to 7 s after the TERM with the command's 7, and the command must be gone. In the fourth, the command sets its TERM trap, then writes its pid and holds, and the case sends the TERM as soon as the pid is there, right after the command has started. The watch must end with the command's 7 and the command must be gone. The fifth and sixth put atimeoutstand-in on PATH that makes its own group and exits on a TERM without passing it on, as GNUtimeoutcan beforeforkreturns, once for the command and once for the dump, with a lock the held child inherited. The case waits until the child and itstimeoutare there with the lock held, sends the watch a TERM, and the child must be gone and the lock free. A failed case prints the last line of what it read (for exampledumping: yes, ended in N s, left: none) on its FAIL line, so a log that keeps only FAIL lines shows why.teestarts, before and after its pid is recorded: the runner must end with 143 or 129, cargo must never start, andteemust end.next arm. The stub sets a trap that ends it with 7 one second after a TERM, then writes its pid and its parent's pid (itstimeout) and holds. The case waits until that pid file is there and the stub'stimeoutis asleep waiting for it (polled every 0.1 s), checks that it got there, and sends a TERM to the runner's pid, once with no runner trap and once with a runner trap that printstrap ranand exits 143. Each time the runner must end with 143 before the call's 20 s bound, the stub and itstimeoutmust be gone, the lease must be free andnext armmust not appear; with the trap,trap ranmust appear. The call islease_boundedin the runner's shell,lease_capture(whose temp dir must be gone too), alease_boundedwhose copy ofrun_boundedwaits between starting the child and reading its pid, so the TERM lands in that window, alease_boundedunder thetimeoutstand-in that exits without passing the TERM on,lg_processwith a stub load (also under that stand-in; skipped where bash is older than 4.1, as/bin/bash3.2 on a Mac is), and nine arms taken fromdepth-ds41.sh,depth-glm5next.sh,depth-qwen3moe.shandcstate-ab.sh: the DS41 and Qwen3-MoEoursand reference arms, the DS41pparm, the Qwen3-MoE memory-capped arm, the DS41 and GLM5Next preheats (with a held stub in place of the preheat script) and cstate-ab.sh's arm loop.MEM_SCOPE_SCRIPTruns the held stub and gets two TERMs 0.1 s apart; it must return the stub's 7, and the stub must be gone.perf, and the case sends the runner a TERM duringperf record(also under thetimeoutstand-in), before the decoder's pid is assigned, and duringannotateand during the callers report. Each time the runner must end with 143 before the 20 s bound, with the decoder, the profiler and theirtimeouts gone and the lease free; before the pid, noperfcommand may run. A decoder that ends with 23, and one that ends with 124, must fail the run with that code, thedecode exited <code>:line and the last 20 lines of its log.lease_filterwaits between starting the filter and reading its pid, and the case sends the runner a TERM there, with no runner trap, with one that exits and with one that returns. The filter must be gone and the runner's stderr must reach EOF before the case cleans up, the lease must be free, and a trap that returns must find its own trap back afterwards. The case never signals the filter itself.lease_capture's output and code; the EXIT trap it extends (a quoted one and one with a trailing comment, both still run), read in the runner's own shell with its positional arguments untouched; amktempthat fails (code 70, empty output);lease_filter's two streams; a failed filter's code; a refused bound that starts no filter; dma-dram-share.sh refusing0600; expert-union-dump.sh stopping at a failed prompt; and a command that reads the runner's stdin.Left open:
run_bounded,lease_filter, gate.sh and the watch each set their trap before they start their child. The lease self-test reaches the first two windows with a planted wait, and the card tests reach gate.sh's with a signal planted right afterteestarts. The watch's window before a dump's pid is read is reached only by a mutant under "Fail first", and no mutant in this run reaches the watch's window before the command's pid is read.$stopin two places. The loop's condition ends the loop at its next turn, so no new round starts after the signal; the round under way when the signal came may still scan withpsand print "nothing dumped". The check before a dump keeps that round from starting a dump.What I ran into
This does not block the PR.
timeoutis uutils coreutils 0.8.0. Whentimeoutitself receives a TERM from outside, GNU coreutils returns the child's code and uutils returns 143:timeout 900 bash -c 'trap "sleep 1; exit 7" TERM; sleep 30 & wait' & p=$!; sleep 1; kill -TERM $p; wait $p; echo $?prints 143 there and 7 with GNU coreutils 9.4 on a DGX Spark.run_boundedreturnstimeout's code, so on such a machine an ended runner reports 143 instead of the binary's code, and the two gpu-gate self-test cases that look forexit 7expect GNU's behavior. Options: take the binary's code from somewhere other thantimeout's status; or require GNUtimeoutfor the gate runners and say so in the tools' requirements.just contrib-check --tier t1on the DGX Spark, the q38-3090-server self-test failed once at this head:FAIL second-turn-restored: no 'call stream end .*kept=0 restored=2100 end_us=420000' in the happy run's output. Main55acee0bin the same container printedq38-3090-server.sh: self-test ok. This PR does not touchtools/ref/q38-3090-server.sh, and its self-test runs a stub server under a stubgpu-gate.shin a temp tree, so none of the changed runners is in that path. The same self-test ran 20 times at this head on a Mac with no failure (Q38SRV runs=20 red=0). It looks like a timing flake of that stub run under the t1 load; I did not look further.shellcheckis not installed, at main too.Code shape
run_boundedandlease_stophave one owner,tools/gate-bound.sh, which the gate runners already source and lease.sh and stack-watch.sh now source too; the four gate runners,lease_boundedand stack-watch.sh run their bounded children throughrun_bounded, and perf-decode.sh and load-groups.sh stop their backgroundtimeoutwithlease_stop. The timing runners' bounded children go throughlease_bounded,lease_captureorlease_filter. The DS41 and Qwen3-MoE arms, the two preheats and cstate-ab.sh's arms no longer start atimeoutof their own.stack-watch.shkeeps its own trap for its loop and its dump.lease_filterrefuses by name a stream other thanstdoutorstderrand a call without a filter or a--command, and checks its bound aslease_boundeddoes, all with 64 and before the filter starts. A temp dir or FIFO it cannot make returns 70, and so does gate.sh when it cannot make its FIFO.lease_stopreports a group that outlives its KILL and returns 70. dma-dram-share.sh now refuses a leading zero. A runner that is ended still exits with a status, now the binary's, a failed filter fails the arm, and a failed decoder fails perf-decode.sh with its code and the end of its log.tools/check-comments.shpasses at the head on the Mac (mac-static: check-comments rc 0) and on the DGX Spark.gate()'s default bound is still 60 s. One window is wider: the stack-watch dump case allowed[0-7] sand now allows1?[0-9] s, because its stub gdb now ends six seconds after its TERM. Without the signal passed on, the stub holds until the dump's TERM at 120 s, so the window still tells the two apart. The case carries aPIN(2026-10-15):comment with this reason. No other case changed its expectation.cargo fmtandcargo clippyare clean on what I touched; the lint count did not go up. No Rust file is touched.Duplication found or removed (
path:line, at main55acee0b): the same foregroundtimeoutstart was intools/host-gate.sh:25,tools/gate.sh:74,tools/gate.sh:79,tools/gpu-gate.sh:1779,:1794and:1799,tools/ref/time-gate.sh:38andtools/ref/lease.sh:461. All of them now go throughrun_bounded. The DS41 and Qwen3-MoE arms started their own attools/ref/depth-ds41.sh:1619,:1621,:1730and:1732andtools/ref/depth-qwen3moe.sh:2223,:2372and:2378, the preheats attools/ref/depth-ds41.sh:1588andtools/ref/depth-glm5next.sh:820, and cstate-ab.sh attools/ref/cstate-ab.sh:65.lease_boundedran inside a substitution or a pipeline in ab-decode.sh (for exampletools/ref/ab-decode.sh:58), decode-measure.sh, depth-decode.sh, depth-glm5next.sh, depth-gpu.sh, dma-dram-share.sh, governor-ab.sh, perf-decode.sh, qdot-rate.sh (tools/ref/qdot-rate.sh:49) and expert-union-dump.sh (tools/ref/expert-union-dump.sh:16). All of these now run in the runner's shell throughlease_bounded,lease_captureorlease_filter. The backgroundtimeouts attools/ref/perf-decode.sh:31andtools/ref/load-groups.sh:152had no stop of their own and now stop throughlease_stop. Other runners undertools/ref/still start some commands under a foregroundtimeoutof their own (for exampletools/ref/depth-ds41.sh:1355); they are not changed here.What I ran
Everything here ran at
dd64d463, whose base is main55acee0b. The branch also merges with upstream/main97ff99c8without a conflict; nothing was run again for that.On a Mac
./tools/mac-static.sh 55acee0b…, with a local edit totools/check-recipes.shthat starts its blocks three at a time:mac-static: ok.check-recipesran the tool self-tests, among themcard-tests: 733 tests, 0 failed,gpu-gate self-test: 106 of 106 ok,stack-watch self-test: okand the lease self-test, withcheck-recipes: 57 tool self-tests ok./bin/bash3.2.57, withLC_ALL=C:/bin/bash3.2.57bash tools/ref/stack-watch.sh --self-teststack-watch self-test: okstack-watch self-test: okbash tools/ref/lease.sh --self-testself-test: ok (0 failures)self-test: ok (0 failures), withskip bounded-ds41-load: the runner's bash has no exec {fd}<>bash tools/gpu-gate.sh --self-testgpu-gate self-test: 106 of 106 okgpu-gate self-test: 106 of 106 okbash tools/ref/card-tests/run.shcard-tests: 733 tests, 0 failedcard-tests: 733 tests, 0 failedbash tools/ref/card-tests/cpu-guard.shcpu-guard: 9 tests, 0 failedcpu-guard: 9 tests, 0 failedbash tools/ref/load-groups.sh --self-testself-test: ok (0 failures)self-test: ok (0 failures)bash tools/check-comments.shcheck-comments: ok (905 files, 132954 comment lines; …)check-comments: ok (905 files, 132954 comment lines; …)shellcheckon the changed timing scripts did not run:shellcheck: command not found, the same at main55acee0bon that Mac.On a DGX Spark
All runs are in the
bloomery-devCUDA 13.3.1 container (aarch64, GNU bash 5.2.21, GNUtimeout9.4,LC_ALL=C).The shell self-tests, from the tree's root:
bash tools/ref/stack-watch.sh --self-teststack-watch self-test: okbash tools/ref/lease.sh --self-testself-test: ok (0 failures)bash tools/gpu-gate.sh --self-testgpu-gate self-test: 107 of 107 okbash tools/ref/card-tests/run.shcard-tests: 733 tests, 0 failed, withok gate.sh: a FIFO it cannot make ends 70bash tools/ref/card-tests/cpu-guard.shcpu-guard: 9 tests, 0 failedbash tools/ref/load-groups.sh --self-testself-test: ok (0 failures)bash tools/ref/depth-glm5next-stub.shdepth-glm5next-stub: 49 checks, 0 failedbash tools/check-comments.shcheck-comments: ok (905 files, 132954 comment lines; …)bash tools/ref/depth-ds41-stub.shdepth-ds41-stub: 84 checks, 7 failed, the same line and failures as main55acee0bin the same container, so not from this changebash tools/ref/depth-qwen3moe-stub.shdepth-qwen3moe-stub: 86 checks, 59 failed, the same line and failures as main55acee0bin the same container, so not from this changeThe two stub tests' failure lines name random temp dirs, which differ between the two runs; with those names made equal, the head's failures are the main's. In this container the DS41 stub's runs print
systemctl: command not found. The cause of the Qwen3-MoE stub's failures was not looked into.Two repeats at the head: the lease self-test 20 times,
lease-selftest-repeat: runs=20 red=0, and the card tests' four cases that signal right afterteestarts, 50 times,TEE-HEAD runs=50 red=0.just contrib-check --tier t1, which runs the t0 units and the host-nightly units:DONE tier=t1 total=104 red=1 wall=415s red: check-recipes. Main55acee0bon the same machine printsDONE tier=t1 total=104 red=1 wall=413s red: check-recipes. Both fail gate-batch'sFAIL budget: --over-budget-ok passes it: rc 70, want 0andFAIL budget mutant: without the check the over-budget item runs: rc=70 …. The head also failed the q38-3090-server self-test once; see "What I ran into". t0 was not run on its own at this head, and t1 was not run on an x86_64 host.The gates:
tools/affected-gates.sh 55acee0b --no-boxselects166 of 166 gate-recipes. Each ran asBLOOMERY_BOX_LOCAL=1 just <recipe>. A gate that failed ran again on main55acee0bon the same machine, and the two failure lists were compared:gates-affected: 175 gates, ok 32, same as base 143, differs 0.justas<recipe>@BLOOMERY_FIXTURE_VARIANT=<variant>, a formjustrejects witherror: invalid override path. They are gate-gpu-glm5next-e2e with iq4xs, q2kxl and glmffnkq, gate-gpu-glm5next-mtp with iq4xs and glmffnkq, gate-gpu-glm5next-stagger with glmffnkq, gate-gpu-glm5next-nvtier with q6kdown, and gate-gpu-qwen35moe-e2e with unjoined and unjoinedq6.stack-watch's self-test under a child subreaper that never reaps orphans, three runs on CPUs 0 to 3:
stack-watch self-test: okeach time, with the dump casedumping: yes, ended in 6 s, left: none,ended in 7 sandended in 6 s.Fail first
Each mutant was planted in a copy of the head's tree, on the same DGX Spark and in the same container, except the last two, which ran on the Mac. The check ran on the mutant, then on the restored copy, and the restored source was compared with the head:
mutants: total=20 killed=19 restored=20[derived from the 20 runs]; the one not caught is the readiness mutant below. Four use a probe outside this PR that sends the TERM inside a delay the mutant plants.run_boundedstarts the child before it sets its trapleft: stub timeout, lease: heldinbounded-startup-termlease_capturetakes the output with$(lease_bounded … 2>&1)self-test: FAIL (12 failures), among them the preheat and cstate-ab.sh armslease_filtersets no trap of its ownreader=alive stderr=openinbounded-filter-open-term-none-readerlease_filter's trap does not end and reap the filterreader=alive stderr=openinbounded-filter-open-term-none-readerlease_stopsends one TERM totimeoutonlyleft: stub, lease: heldinbounded-fork-term,left: decoder record, lease: heldinbounded-perf-fork-termlease_stopreads thepsrows without its ownIFSleft: stub, lease: heldinbounded-ds41-load-fork-termlg_processsets no signal trapleft: stub timeout, lease: heldinbounded-ds41-load-termleft: decoder decoder-timeout, lease: heldinbounded-perf-record-termno line matches /^decode exited 23: /inbounded-perf-fail-reasontimeout'sforkdelayed 0.5 srun_boundedleft: child, lock after: heldin the command caserun_boundedleft: child, lock after: heldin the dump casewatch still waiting 26 s after the TERM, gdb started: yes, left: gdbrc 7, ended in 6 s, gdb started: no, left: nonebash -ebash -erc 1, ended in 3 s, gdb started: yes, left: commandrc 7, ended in 6 s, gdb started: yes, left: noneteerun_boundedrunner gone: yes, output ended: norunner gone: yes, output ended: yestee's pidrunner gone: no, output ended: norunner gone: yes, output ended: yesteeand acts on no held signalteestart casestee ended without a FIFO writer: tee pid missing or still aliveteeone TERM and does not reap itteestart cases, 20 timesruns 20 red 9runs 20 red 0awkpipe without the parentheses (on the Mac)bounded-perf-annotate-term-rc: got [2], want [143]just check-recipesself-test FAIL: smoke (a batch in a batch) or check-recipes has the wrong never-skipThe readiness mutant is not caught at this head because the defect it was made to show is fixed. On an earlier head it left the stub holding the lease, when a TERM came while GNU
timeoutwas still infork; at this headlease_stopsends the TERM totimeout's group, and every case ends with the lease free even with the delayedfork(race-sanity rc 0 seconds 0.511 clone delayed True). Thelease_stopmutant above now guards that defect.Two mutants ran a second time after a fix to the harness, with their first runs kept: the probe for gate.sh's trap before
teelooked for the old one-line EXIT trap and never planted the mutant, and the first run of the fourteestart cases ran inside the full card tests, where an unrelated depth-serve case failed in the copied tree on the restored run too.Not run at this head: a mutant for the gate.sh case where the FIFO cannot be made, and one for the watch's window before the command's pid is read.
Hardware (if the change is for a machine)
Not a machine-specific change. The runs used a Mac and one DGX Spark (NVIDIA GB10, driver 595.84).
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.