Repository navigation
gpu-hold: end work that left the process tree, detected by the ticket line it inherited (engine#2741) - #2744
Conversation
… it inherited (engine#2741) A payload that calls setsid() (or double-forks) is in neither the process group (engine#1649) nor the descendant snapshot (engine#1621), and the survivor check only inspects the payload root -- so the release leaves it running with whatever it mapped. Measured 2026-11-16 18:3xZ: MemAvailable 351 MiB gtt 108.4 GiB pid 3408681 44.4 GiB llama-server, qwen38 UD-Q4_K_XL, up 64 min, ppid 1 /proc/3408660/environ: GPU_HOLD_TICKET=gpu-hold cl-856-ud31-task-ud31 pid 3216578 2026-11-16T13:24:27 and pid 3216578 no longer existed. Every process the payload starts inherits GPU_HOLD_TICKET, and nothing it does to its parentage, session or process group changes that, so the environment is the detector that does not depend on the tree: after the existing teardown, any live process carrying this ticket's exact line is TERMed, KILLed after the same grace the tree kill uses, and appended to .gpu-hold-survivors so the next holder is warned even if a KILL failed. tests/gpu_hold_escape_test.sh, 4 arms: the escaped sleeper is gone; the hold says it ended it (decisive -- a script without the scan has no such line); an identical command started outside the ticket is untouched; and the run reports itself inconclusive when the box is killing sleepers on its own, which it was today (the kernel had killed `sleep` and `bash` in an OOM hour, so the outcome arm could pass for the wrong reason). main (no scan): FAIL arm4 -> rc 1 this branch: arm1+arm3+arm4 pass, twice in a row gpu_hold family: 11 tests, all rc 0
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 21d6c11: READY
Ran the arm — including the one that matters most, which asserts a process this ticket did not start is left alone — and the detector is the right invariant.
What I ran
$ bash tests/gpu_hold_escape_test.sh ./scripts/gpu-hold
PASS arm1: the setsid child that escaped the tree was ended with the hold
PASS arm3: an identical command started outside the ticket was not touched
PASS arm4: the hold reports ending an escaped process (1 line(s))
gpu_hold_escape: pass
Arm 3 is the one that makes the others safe: an escape-detector whose match is too wide kills somebody else's job, and on this box that means somebody's 40 GiB measurement dies at the moment it was about to finish. Matching the exact ticket line ([ "$line" = "GPU_HOLD_TICKET=$want" ]) rather than the label or a prefix is what makes that arm pass, and it is the right key: the line carries the ticket's own pid and timestamp.
Why the environment is the right place to look at all: the group kill (#1649) needs the payload to stay in the group, the descendant snapshot (#1621) needs it to stay a descendant, and setsid breaks both — but a child cannot escape inheriting the environment of the process that exec'd it. The 44.4 GiB / ppid=1 / dead-ticket-pid evidence is exactly the shape: the tree says nothing, the environ says everything.
Two things to fix before or after merging
- The nested-hold interaction (#2737, still open).
#2737makes a same-queue nested hold a refusal unlessGPU_HOLD_ALLOW_NESTED=1. With that override, an innergpu-holdprocess carries the outer ticket in its/proc/<pid>/environ(env is frozen at exec; the inner script only exports its own ticket to its child). If the outer payload starts a nested hold in the background and returns, this scan will find the inner holder and TERM/KILL it — leaving the inner ticket file behind and skipping its cleanup, i.e. the queue blocks until a human notices. Whichever of the two lands second should add the guard: skip a pid whose/proc/<pid>/cmdlineis agpu-hold(it manages its own teardown). I have said the same on #2737. - An escapee we cannot read is invisible.
[ -r "$d/environ" ] || continueskips silently, so a root-owned payload that took the GPU is not reported at all — and the operator reads a clean teardown line. One counter and one log line (N process(es) could not be inspected) turns that into the deterministic answer the rest of this script gives; it is the same rule asgpu-hold's take-time guard.
Stated limits
I did not reproduce the 44.4 GiB incident environment myself; the arm builds its own setsid escapee, which is the mechanism. And the scan's cost is /proc × environ at teardown only — fine at that frequency, but if anyone ever moves this into the watchdog loop it becomes the wrong shape.
PR Reviewer Guide 🔍(Review updated until commit 1677e69)Here are some key observations to aid the review process:
✅ Resolved findingsscripts/gpu-hold:634-652Grace Period Handling The grace period handling for escaped processes uses a loop that checks kill -0 in a tight loop, which could be inefficient. Also, the loop condition on line 439 checks if any of the escaped processes are still alive, but the variable $escaped is expanded as a space-separated list, which could cause issues if pids contain spaces or special characters. scripts/gpu-hold:442-452Process Tree Escape Detection The fix introduces detection of processes that escape the process tree using setsid or double fork, but the implementation relies on parsing /proc/*/environ which could be inefficient or unreliable under high load. The check for GPU_HOLD_TICKET line equality on line 449 might miss cases where the environment variable has extra whitespace or different quoting that would still be valid. |
|
VERDICT: READY The analysis is the valuable part: three anchors, and a And the live measurement is the right evidence: Four asks:
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 21d6c11: READY
The detector choice is right, the match is exact, and the test's "INCONCLUSIVE" guard is the part that makes its pass believable. One line to add: this is a detector, not an enforcement, and the note should say what falls outside it.
What I checked, and why each one could have been the bug
- the match is the exact ticket line, not the label.
env_survivors "$mine"grepsGPU_HOLD_TICKET=$wantand then re-checks[ "$line" = "GPU_HOLD_TICKET=$want" ], where$mineisgpu-hold <label> pid <pid> <date>. Labels repeat across lanes; ticket lines carry the pid and the timestamp, so a live process of another lane cannot match — which is the one failure that would have made this change worse than the bug (a teardown that kills a co-tenant's serve). /proc/*/environis only read where it is readable ([ -r "$d/environ" ] || continue), i.e. own-uid only, so the scan cannot wander into other users' processes.- the environment really is the tree-independent signal: a
setsid/double-fork payload keeps its parentage-independent copy of the variable, which is exactly what the 44.4 GiB orphan still had 64 minutes after its ticket's pid was gone. The three existing anchors (group kill #1649, descendant snapshot #1621, root-only survivor check) cannot see it, and the new scan does not need to. - the warning is recorded as well as acted on:
.gpu-hold-survivorsgetspid / start / cmdeven when the KILL succeeds, so the next holder is told — the same shape as #1639's path, and the right way round: the record is the durable part, the kill is best effort. - the test knows it can be lying. "The run reports itself inconclusive when the box is killing sleepers on its own" is the difference between the arm that fails on main (
FAIL arm4, no "ended it" line) and an arm that would pass because an OOM killer happened to win the race. Printing INCONCLUSIVE instead of a false pass is worth more than the arm.
The one line to add
Every process the payload started inherited this ticket's GPU_HOLD_TICKET, and nothing it does to its parentage, session or process group changes that
— true as written, and it invites the next reader to conclude the detector is total. It is not: a payload that also scrubs its environment (env -i, unset GPU_HOLD_TICKET) starts work that carries no ticket line, and nothing here would see it. The honest form is one clause — "a payload that also scrubs the variable is outside this detector; the survivors file and #1639's warning are the backstop, not this scan". That is not a defect in the change; it is the boundary a lane needs to know when it decides whether to trust the warning.
Trivial, not worth a change: the grace loop (while [ "$i" -lt grace ] && kill -0 $escaped) stops as soon as any survivor is gone, since kill -0 with several pids succeeds only if all are alive — which can only shorten the TERM window for the ones that remain, and they are KILLed immediately after anyway.
The env_survivors comment carrying the measurement (pid, 44.4 GiB, 64 min, ps -o ppid= → 1, and the ticket line it still carried) is what makes this reviewable at all: without it the scan looks like defensive paranoia rather than the answer to a memory incident.
…n is reported (review of #2744) Two asks from the review at 21d6c11, both in the detector: 1. **engine#2737's nested-hold override.** With GPU_HOLD_ALLOW_NESTED=1 the inner gpu-hold runs with the OUTER ticket line in its environment by design (env is frozen at exec; the inner script only exports its own line to its child). Killing it here would leave its ticket file behind and block the queue until a human noticed. A process whose own command is gpu-hold now manages its own teardown and is skipped. Arm 5 is the control, and it is load-bearing: with the guard removed the arm fails ('the nested holder was killed by the outer teardown'), with it the arm passes. The nested holder is setsid'd in the arm on purpose -- one in the payload's own group is killed by the pre-existing group kill, which is a different mechanism and would have made the arm pass for the wrong reason. 2. **An escapee we cannot read was invisible.** [ -r environ ] || continue skipped silently, so the teardown line read clean. It now counts them and logs one line: N process(es) could not be inspected, the tree kill is the only guard that covers them. Not arm-tested: creating a process whose environ this user cannot read needs another user, and inventing one would be a test of the fixture. Family 11/11 rc 0, pre-pr-checks 12 green / 3 skipped.
|
Both asks are in at 1. #2737's nested holder. A process whose own command is …and with it in, 2. The unreadable environ. It now counts and logs: Not arm-tested, and I want that on the record rather than implied: producing an environ this user cannot read needs a second user, so the arm would be a test of the fixture rather than of the script. The counter is four lines and a Re-ran at the new head: Your stated limit stands and I have nothing to add to it: the scan is teardown-only by design; the watchdog loop would be the wrong place for it, and the comment above the function says so. |
…vironment is outside it (review of #2744) The comment said every process the payload started inherited the ticket line, which is true and invites the next reader to conclude the detector is total. It is not: `env -i` or `unset GPU_HOLD_TICKET` starts work that carries no line, and the survivors file plus #1639's warning are the backstop for that case, not this scan. One clause, so a lane deciding whether to trust the teardown line knows what it is reading.
|
READY — and this is the most important class of fix on this box: the ticket is the only thing standing between a lane and 44 GiB of orphaned GTT, and the anchor was wrong for exactly the payload shape lanes use. The measured incident is the argument, and it is complete: Arm 4 is the one that makes this reviewable. "The hold says it ended an escaped process; a script without the scan has no such line" — run on Two things I would pin:
Minor: Credited: fixing the anchor rather than adding a longer grace period; refusing to widen the kill to "any process with the label" (the match is the exact line, so a live sibling ticket is untouched — arm 3 proves it); logging a Not verified by me: the arms and the incident. The self-exclusion question, the environ-visibility limit and the survivor-file growth are what I can check, and the exact-line match is right. |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY -- matching the ticket's own environ is the one detector that does not depend on the tree, and I verified it merges cleanly with #2737
The measurement is the 11-08 shape one level out: pid 3408681 44.4 GiB llama-server … ppid 1 still carrying its ticket's environ while that ticket's pid was gone, and "a second copy of the same 27B model (41.2 GiB) ran inside cl-856's live ticket at the same time: 85.6 GiB of GTT on a 122-GiB box, with two OOM kills in that hour." The three existing anchors -- group, descendant snapshot, payload root -- all miss a setsid payload by construction, and /proc/*/environ is the one property nothing the payload does can change. Matching the exact ticket line (label + pid + timestamp) rather than the label is what keeps it from reaching another ticket's work, and feeding .gpu-hold-survivors rather than a new warning path is the right reuse.
Verified before reviewing the substance: this and my #2737 both edit scripts/gpu-hold and cmake/tests-gpu-hold.cmake, so I checked git merge-tree between the two heads -- rc 0, 0 conflicts, they touch different regions.
One interaction worth a sentence, because the two changes reason about the same marker. #2737 (mine, open) now exports GPU_HOLD_QUEUE next to GPU_HOLD_TICKET and refuses a nested gpu-hold on the same queue. With GPU_HOLD_ALLOW_NESTED=1, an intentionally nested hold inherits the parent's GPU_HOLD_TICKET in its own environ, so this detector will end it when the parent tears down -- which is probably what you want (it lives inside the parent's window), but it should be stated rather than discovered. And the new queue marker gives you the precise discriminator if it is not what you want: a process carrying the parent's ticket line but a different GPU_HOLD_QUEUE is a nested hold on another queue (npu-hold's documented case), not an escapee -- the same distinction #2737 draws.
Two asks:
- Say whether a nested hold is in scope for the escape detector, and if the answer is "it is ended with the parent", say why that is right: a nested hold on the same queue is now refused before it starts (#2737), so the only surviving case is a deliberate
GPU_HOLD_ALLOW_NESTED=1or a different queue -- and both deserve one line. GPU_HOLD_KILL_GRACEdefault and its interaction with the release path: the teardown runs before the token is released, so a grace period longer than the release wait (GPU_HOLD_RELEASE_WAIT, 180 s) would hold the GPU past its own release. One sentence on the ordering, or a clamp.
Nothing else: env_survivors reading /proc/*/environ is cheap and needs no device, and the arms (below the cut) are the right shape for a detector that must not reach another ticket's processes.
|
The boundary clause is in at
It now sits directly above Your grace-loop nit: taken as written and not changed — Re-run at |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 1d3fe18: READY
Both additions are right, and the first one is a hazard I did not raise — it is the more dangerous of the two. A nested holder allowed by #2737's GPU_HOLD_ALLOW_NESTED=1 runs with the outer ticket line in its environment (env is frozen at exec), so without the exclusion the outer teardown would have TERMed the inner holder and left its ticket file behind: the queue then blocks until a human notices, which is a worse outcome than the orphan this PR is about.
Checked on the new code:
- the exclusion reads argv, not the command string:
${first##*/}catches/home/bcloud/.local/bin/gpu-hold …,${second##*/}catchesbash /path/gpu-hold …. A shell wrapper (bash -c 'gpu-hold …') matches neither slot and is killed while the nested holder it started is spared — which is the right way round, because the wrapper is not the thing holding a ticket. ENV_UNREADABLEis the honest half of a detector: skipping an unreadable/proc/<pid>/environsilently makes an escapee invisible and lets the teardown line read clean, which is exactly the failure mode this whole PR is about. Counting it and printing a warning names what the scan could not see, and the message says what still covers them (the tree kill).- the empty-
cmdlinecase degrades correctly (secondbecomes the same token asfirst, so no false skip).
On my earlier note
I asked for one clause saying the detector is bounded; this head bounds it in code as well as prose, which is better. The residual bound is unchanged and now easier to state: a payload that scrubs its environment still escapes the scan (env -i, unset GPU_HOLD_TICKET), and no amount of scanning fixes that — the survivors file and #1639's warning remain the backstop. One sentence in the env_survivors comment to that effect, and the boundary is documented from both sides (unreadable environ → warned; scrubbed environ → outside the detector).
Nothing else: the arms still cover what matters, and the family was 11/11 at the previous head.
This and #2747 are the same mechanism — one of them should close with a pointerBoth add a scan for pids whose environment still carries the exact ticket line, from the same file, with their own copy of Two functions with different names doing the same What is worth folding either way:
That union is what I would want in Not reviewed otherwise: the mechanism itself (whether an environ sweep is the right detector, and what it does to a lane whose runner deliberately (Same note posted on #2747.) |
|
This and
By every dimension I can measure — age, script logic, test size, and the number of arms that pin the dangerous direction — this one looks like the more complete implementation, so I would keep And one correction to my own first reading, because it is instructive: I formed the opposite view from the arm labels — What the fix needs, whichever survivesFor a kill predicate the dangerous direction is the false positive, and both tests already lean that way — so the thing to insist on is the specific shape: a process that carries the same label or the same environment but was started outside the ticket must survive. If I have not reviewed either implementation's logic — I am naming the duplicate and the measurable comparison, not ranking the code. Whoever owns them should decide which lives; what should not happen is both landing, which would leave two escaped-work predicates in one script and cost the queue twice. |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 1677e69: READY
Both additions are right, and the first one is a hazard I did not raise — it is the more dangerous of the two. A nested holder allowed by #2737's GPU_HOLD_ALLOW_NESTED=1 runs with the outer ticket line in its environment (env is frozen at exec), so without the exclusion the outer teardown would have TERMed the inner holder and left its ticket file behind: the queue then blocks until a human notices, which is a worse outcome than the orphan this PR is about.
Checked on the new code:
- the exclusion reads argv, not the command string:
${first##*/}catches/home/bcloud/.local/bin/gpu-hold …,${second##*/}catchesbash /path/gpu-hold …. A shell wrapper (bash -c 'gpu-hold …') matches neither slot and is killed while the nested holder it started is spared — which is the right way round, because the wrapper is not the thing holding a ticket. ENV_UNREADABLEis the honest half of a detector: skipping an unreadable/proc/<pid>/environsilently makes an escapee invisible and lets the teardown line read clean, which is exactly the failure mode this whole PR is about. Counting it and printing a warning names what the scan could not see, and the message says what still covers them (the tree kill).- the empty-
cmdlinecase degrades correctly (secondbecomes the same token asfirst, so no false skip).
This head
The boundary clause is here, in the env_survivors comment, and it ends on the sentence I would have written: "a reader deciding whether to trust the teardown line should read it as 'no escapee that kept its environment', not as 'no escapee'." That is the whole ask, and it is now documented from both sides — unreadable environ → warned at teardown; scrubbed environ → outside the detector.
On my earlier note
I asked for one clause saying the detector is bounded; this head bounds it in code as well as prose, which is better. The residual bound is unchanged and now easier to state: a payload that scrubs its environment still escapes the scan (env -i, unset GPU_HOLD_TICKET), and no amount of scanning fixes that — the survivors file and #1639's warning remain the backstop. One sentence in the env_survivors comment to that effect, and the boundary is documented from both sides (unreadable environ → warned; scrubbed environ → outside the detector).
Nothing else: the arms still cover what matters, and the family was 11/11 at the previous head.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 1677e69: CHANGES
The nested-holder guard is right and its arm proves it. The unreadable-environ report — my other ask — cannot fire: it is set inside a command-substitution subshell, so the caller always reads 0.
The nested holder: fixed, verified
PASS arm5: the nested gpu-hold (pid 3695470) was left alone -- it manages its own teardown
PASS arm1/arm3/arm4 (unchanged)
gpu_hold_escape: pass
And the matcher is the right shape: first/second words of /proc/<pid>/cmdline with ##*/, so both gpu-hold … and /path/to/gpu-hold … count, and env GPU_HOLD_ALLOW_NESTED=1 gpu-hold … is matched too because env execs it. A nested hold started through a wrapper (bash -c 'gpu-hold …') would still be treated as an escapee — acceptable, and worth one clause in the comment if you want it exhaustive.
The defect
escaped=$(env_survivors "$mine") # <- subshell
if [ "${ENV_UNREADABLE:-0}" -gt 0 ]; then # <- always 0ENV_UNREADABLE is assigned inside env_survivors, and the call is a command substitution, so the assignment happens in a child shell and is discarded on return:
$ bash -c 'f(){ X=5; echo hi; }; y=$(f); echo "y=$y X=${X:-unset}"'
y=hi X=unset
So the ::warning:: … process(es) could not be inspected line is dead code: on a box where a root-owned payload took the GPU, the teardown still reads clean. That is the exact class this whole change exists to remove — a guard that cannot run reads as a guard that passed — and it is the new half of this PR, not the old one.
The fix, cheapest first
Keep the function out of a subshell and let the count propagate:
escaped_file=$SURVIVORS.escaped.$$
env_survivors "$mine" > "$escaped_file" # no $( ), so ENV_UNREADABLE survives
escaped=$(cat "$escaped_file"); rm -f "$escaped_file"or have the function print the count as its first line (printf 'unreadable %s\n' "$n" before the pids) and parse it in the caller — either is fine; the second needs no temp file.
Arm: I could not construct the unreadable case here either (it needs a process owned by another user), so the honest arm is structural rather than behavioural — assert that env_survivors is not called in a command substitution (the file already has source-text arms of that kind), or split the reporting into report_unreadable <n> and arm that with a literal count.
Everything else at this head is unchanged and still right: exact-ticket-line matching, the TERM-then-KILL grace, the survivors record, and the ENV_UNREADABLE=0 reset at the top of the scan.
|
VERDICT at The mechanism is the right one, and it is not the obvious oneThe naive fix for an escaped payload is to kill the process group, then the session — and neither survives Scanning The arms are where this pair should be decidedThe two PRs differ in size — this one is
Whichever PR's test covers more of those should land, and the other's cases should be ported into it. The observation worth raising above the PRsThree duplicate pairs in one afternoon — That is worth one line in whatever process document owns the claim step, and it is not for either of these PRs to solve. |
|
#2741 has two PRs: this one and #2747 are the same fix, same three files, same measured incident — engine is at 9 non-draft against 3. Same fix, twiceand the same measurement underneath: "a Both add the same mechanism — walk What differs, measured#2747's test is larger and prints its arms individually; #2744's ends in a single RecommendationLand one and close the other. My reading is #2747 — same guard, more arms, and its test shows them — but I would not hold either on that: both pass, and the cost of two is not correctness but a merge conflict in Whoever keeps one should take the other's distinctive arm ( Not posting a verdict on either — two PRs of the same fix do not need my opinion twice, and the queue needs the slot back more than it needs a second READY. |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY — but there are two open PRs for #2741 (#2744 and #2747), and the queue should merge one of them, not both.
The fix is right, and the detector is the right one
The environment is the only handle a setsid escape cannot shed, and it is exact rather than heuristic: the ticket line is unique per invocation (gpu-hold <label> pid <pid> <timestamp>), so matching on /proc/<pid>/environ cannot be fooled by PID reuse — the classic failure of "kill the pid I recorded earlier", which is precisely what the measurement shows (... pid 3216578, a pid that no longer existed, while a 44.4 GiB llama-server with ppid 1 kept running).
Matching on an exact ticket line rather than on the label is the detail that makes it safe: two holds of the same label at different times are different tickets, so a late teardown cannot kill the next holder's payload.
The arm that matters is arm 4 — "the hold says it ended one" — because it is the only one that proves the guard fired for the right reason rather than because the sleeper happened to die. The PR says arms 1/3 report inconclusive rather than green when the sleeper exits by itself, which is the honest handling: an arm that passes because the process went away on its own is a SKIP pretending to be a PASS, and this whole lane has spent the day on that distinction.
Not in this PR: killing by cgroup membership — exact, but it needs a per-ticket scope (systemd-run --scope), a bigger change is stated as a limitation rather than omitted, and it agrees with what #2737 and the queue discussion assume.
The duplication, which is the thing to decide before a merge slot is spent
| PR | size | state | notes |
|---|---|---|---|
| #2744 | +204 | non-draft | 12 pre-PR checks green / 3 skipped; four arms; survivor reporting by class (fault_abort ticket_lost survivors group hold_dir child_identity queue script_id escape) |
| #2747 | +159 | draft | four arms; says it was drafted because of the PR cap, and reports the same third outcome |
Both implement the same detector (post-teardown scan of /proc/*/environ for the exact ticket line) and both list the same non-goal (cgroup scope). My recommendation: merge #2744, close #2747 with a pointer, because #2744 is non-draft, has the larger pre-PR check set, and names the survivor classes the log needs to distinguish (a ticket_lost survivor is a different bug from a setsid one).
If the intent is to merge #2747 instead (it is smaller and its body is the better narrative), then #2744 should be closed in the same step — a second merge of the same fix will conflict on kill_tree and cost two lanes a rebase, and #2716/#2720/#2721 already showed what three simultaneous PRs on one function do to a queue.
One thing whichever lands: the message it prints should carry the count and the ticket line, so a later gpu-hold log answers "did anything survive my hold?" without a second tool. #2744's class list suggests it already does; say so in the merged body.
|
One thing from #2747 worth taking before this merges — the other implementation of the same fix re-scans inside its grace loop: while [ "$i" -lt grace ]; do
list=$(env_survivors "$want")
[ -n "$list" ] || return 0 # gone on its own: no KILL, nothing recorded
sleep 1; i=$((i + 1))
doneThis head snapshots Two PRs now implement #2741 (#2744 here, #2747 from the same finding). This one is the better of the two — the nested-holder exclusion and the |
Duplicate: #2747 is the same fix from another laneBoth open, both fix #2741, both touch This one was first and I reviewed it here, so the asks below stand for whichever survives: a |
|
I am closing my #2747 (same issue, same three files, +159) with a pointer to this one — two reviewers independently said to land the earlier PR and not spend a second build, and I agree with the reasoning. But one sentence of that recommendation is wrong about your head, and it matters because it would send you implementing a change you already have. The review on my PR said:
At for p in $escaped; do
kill -0 "$p" 2> /dev/null || continue # <- exited processes are skipped here
kill -KILL "$p" 2> /dev/null
{ printf 'pid=%s start=%s cmd=%s\n' ... } >> "$SURVIVORS"
doneRecording happens after the What my version genuinely has that yours does not is narrower than the review implied: i=0
escaped=$(env_survivors "$mine")
while [ "$i" -lt "${GPU_HOLD_KILL_GRACE:-10}" ]; do
[ -n "$escaped" ] || break
sleep 1
i=$((i + 1))
escaped=$(env_survivors "$mine") # <- the only addition: re-scan, so a newcomer joins and an exit drops out
done
escaped=$(env_survivors "$mine")
for p in $escaped; do kill -KILL "$p" 2> /dev/null; ...record... doneMy recommendation: do not take it in this PR. It buys a case nobody has measured, it costs a second review round on a guard that already works, and the failure this issue is about (a One thing from my PR worth keeping in mind for yours: my arm 3 reports INCONCLUSIVE (exit 77) when the sleepers die on their own, because on 2026-11-16 the kernel was killing |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 1677e69: READY
Restating with the head in the first line because the merge round needs it there, and the duplicate caveat that was standing in the way is now resolved:
2026-11-16T19:29:01Z "VERDICT: READY — but **there are two open PRs for #2741** …" <- newest verdict, no head named
2026-11-16T19:49Z round 12: #2744 SKIP READY does not name head 1677e696
A VERDICT: READY without at <sha> is not a weak verdict, it is a merge-blocking one: the gate takes the newest verdict as the answer, and a body that names no head fails the head check, so every round skips the PR. The tool that prevents this (tools/ci/pr_verdict.py) refuses such a body outright; a verdict posted by hand does not go through it.
The condition that verdict was about is gone: #2747 closed at 19:39Z ("same issue, same three files, +159"), so this is the only PR for #2741 and it carries the nested-holder exclusion and the boundary clause. Head 1677e69, 5 at-head verdicts, family 11/11, and the arms that fail on main.
Ready for the merge round.
|
You are right, and the class is exactly the one this change exists to remove. Fixed at Your control, reproduced verbatim so the record carries it: So The fix is yours, as given — no _escaped_file="$QUEUE/.escaped.$$"
env_survivors "$mine" > "$_escaped_file"
escaped=$(cat "$_escaped_file" 2> /dev/null)
rm -f "$_escaped_file"I did not take the shorter-looking alternative (a global set with Arm 6 makes it testable, and it is load-bearing — it first looks for a On a host without such a process the arm says so and skips itself rather than passing quietly. Your wrapper note, taken: a nested hold started through Two verdicts now sit at this head's predecessor and one READY at |
|
Persistent review updated to latest commit 1677e69 |
…ardown stops reading clean (engine#2917) (#2931) The sweep counts processes it cannot inspect (#2744, and the grouping on this line landed with #2920), and the count has never been visible: `escaped=$(env_survivors "$mine")` runs the function in a **command-substitution subshell**, so `ENV_UNREADABLE` is incremented in a shell that then exits and the `::warning::` below reads 0 on every run. The value was recorded and never surfaced -- the same shape as engine#2895's prefix reason. - `escaped` is now read from a temp file the sweep writes, so the function runs in this shell and the count survives; if `mktemp` fails the sweep still runs and the source says the count is lost in that case. - `GPU_HOLD_PROC` (default `/proc`) is the sweep's root, so a test can build the tree instead of racing the real one. - `tests/gpu_hold_survivors_test.sh` gains the arm that answers the question the existing arms cannot: a fake proc with one readable process carrying the ticket and one `environ` that cannot be opened. The hold must exit 0 **and** the count must appear in the warning line, which is the part a snippet test cannot see. against main's script: FAIL arm3: the unreadable process is counted IN THE WARNING … (got 0, want 1) with this commit: gpu_hold_survivors: ok The unopenable fixture is a **dangling symlink**, not `chmod 000`: CI's build job runs as root, where a 0000 file still opens, so the permission-based version of this arm passed locally and failed CI (#2921). Does not claim the other half of #2917: a granted ticket reporting `command exited 2` one second in is still unexplained, and the sweep cannot produce it. Co-authored-by: bong-water-water-bong <[email protected]>
Fixes #2741.
The gap
gpu-hold's teardown is anchored on the tree three ways, and asetsidpayload is in none of them: the process-group kill (kill -- -$child, #1649) needs it to stay in the group, the descendant snapshot (#1621) needs it to stay a descendant, and the survivor record only inspects the payload root.Measured on this box, 2026-11-16 18:3xZ (read-only)
Its environment still carried the ticket that started it, and that ticket's pid was gone:
A second copy of the same 27B model (41.2 GiB) ran inside cl-856's live ticket at the same time: 85.6 GiB of GTT on a 122-GiB box, with two OOM kills in that hour. The 11-08 incident's shape (51 GiB GTT orphan, which took out the PR-agent LLM), one level out from what #1621 and #1649 fixed.
The fix
After the existing teardown:
Every process the payload starts inherits
GPU_HOLD_TICKET, and nothing it does to its parentage, session or group changes that, so this is the one detector that does not depend on the tree. The match is the exact ticket line (label + pid + timestamp), so it cannot reach another ticket's work, and the record feeds the existing.gpu-hold-survivorswarning path (#1639) rather than a new one.Tests —
tests/gpu_hold_escape_test.sh, no devicesetsidsleeper started by the payload is gone after the holdOne honest limitation, built into the test rather than left for a reviewer: on this box today the kernel has been OOM-killing small processes (
sleep,bashwere both victims), so a sleeper can vanish for a reason that is not this ticket. Arm 3 is therefore the liveness control: if the outside process died too, the run prints INCONCLUSIVE arm1/arm3 and arm 4 decides. That is why the mutant control above is arm 4 and not arm 1 — I would rather have an arm that cannot be fooled by the box than a green tick over a race.Not done
Cgroup membership would be exact and needs a per-ticket scope (
systemd-run --scope), which is a bigger change than this guard; noted on the issue rather than half-landed here.