Repository navigation
gpu-gate self-test: the lib-test stub exits at once on TERM - #780
Conversation
GNU timeout sends its TERM to the child and then to its process group. The stub's handler called sys.exit, whose interpreter shutdown restores the default TERM action; when the group's TERM came during that window on a loaded host, the stub died with 143 and the signal case read 143 in place of the 23 it asked for. os._exit leaves no such window.
There was a problem hiding this comment.
Verdict: CLEAN: The fixture preserves its requested TERM exit code by skipping interpreter shutdown.
Checked
Duplicates: 0 new functions, types or constants; no new duplication.
Complexity: no branches added or changed.
Silent failure: the unchanged LIB_TERM default selects 143; external cancellation sets 23 and checks the returned status.
Tests: shell syntax and embedded lib-test Python parsing passed. Isolated probes of the changed handler passed for configured/default TERM and ignored TERM followed by KILL. The existing status assertion expects 23 for external cancellation.
Gates: no thresholds, cases or assertions changed.
Escape catalog: no C1–C4 pattern matched the diff.
Performance: tooling only; no inference hot path touched.
Notes
The full self-test and repeated-signal race reproduction were not run during validation.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
|
The review is done and the contribution check passed, so I'm merging this. |
gpu-gate 자체 시험에서 가끔 143으로 실패하던 시험용 stub가 TERM을 받으면 바로 끝나게 고칩니다.
What and why
On a loaded machine, the
lib path propagates signalcheck in thegpu-gate.shself-test sometimes reports 143 where 23 is wanted, andlib child is stopped after signalreports the same code with it.The gate is not at fault. The cause is the Python stub that stands in for the lib test. Its TERM handler ended with
sys.exit(23). On one TERM, GNUtimeoutcallskillon the child and thenkill(0, SIGTERM)on its own process group. Whilesys.exitruns the interpreter shutdown, CPython puts the default TERM action back. A second TERM that lands in that short window ends the stub by signal, andtimeouthands that code on. A loaded machine can delaytimeoutbetween its two signals long enough to reach the window.The stub handler now calls
os._exit, so it ends with the wanted code at once and has no shutdown window. The check, its wait events and its expected values stay as they were. The stub writes nothing to stdout before TERM, so skipping the flush loses no output.Real runs are not affected. The Rust test binary installs no TERM handler and ends with 143 on the first TERM, which
gate.shreturns as is.I found no open issue or PR for this.
Release notes: internal: a test fixture ended with the wrong code when a second TERM arrived during its shutdown.
Code shape
LIB_TERMnames, 143 when unset.os._exitis used.cargo fmtandcargo clippy: no Rust changed, so I did not run them.Duplication found or removed (
path:line): none.What I ran
The change is in
tools/gpu-gate.sh, 3 insertions and 1 deletion, in the self-test stub only.The load runs use
gpu-gate.sh --self-test --part 4on a 12-core Linux machine with GNU coreutils 9.7timeoutand Python 3.14.4, with 12 busy loops running. Four copies start together, in three rounds. "base" istools/gpu-gate.shfrom upstream main, "head" is this branch.A longer load run gave the same result on both arms. The failure is rare, so this run does not separate base from head:
An
straceoftimeouton one TERM shows the two kills:To test the mechanism without waiting for the rare case, I ran the handler line of each version and sent a second TERM shortly after the first, at gaps of 300 and 700 microseconds, with 30 tries per gap:
With a real
timeoutand a busy loop pinned to CPU 0, one head run ended with the 60 second bound. A rerun of 600 tries per arm did not repeat it:The stub handler is not involved when a TERM is lost before the handler is installed, so I read the single timeout as
timeoutmissing a TERM right after fork. I did not confirm that.Reproduce: run
bash tools/gpu-gate.sh --self-test --part 4in batches of four on a loaded machine and count theFAIL lib path propagates signallines.Not run:
cargochecks (no Rust change), the other gate self-test parts, and any GPU gate. The change touches no device path.Hardware (if the change is for a machine)
Not a machine change. The runs used a CPU-only load on a 12-core Linux machine and no GPU.
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.