Repository navigation
gpu-hold: a stale inherited ticket is not a nest (engine#2727 review) - #2792
Conversation
#2729 refuses a same-queue nest by reading GPU_HOLD_HELD_QUEUE/TOKEN, which keys off the PRESENCE of the exported variable and not the LIVENESS of the ticket that exported it. A payload that outlives its ticket -- a daemonised child, exactly how the 51 GiB orphan of 11-08 happened -- still carries the marker from a parent whose ticket is long gone, so the next gpu-hold inside it is refused rc 2 with "the outer ticket already holds the GPU" when it holds nothing. GPU_HOLD_TICKET already carries the holder pid ("gpu-hold <label> pid <pid> <ts>"), so a pid that no longer exists means the environment is stale: the hold proceeds and says so in one line. Both refusals are gated on this, and GPU_HOLD_ALLOW_NESTED still wins as before. A recycled pid can only make the guard MORE conservative (the refusal stays), never silently drop a real nest. Arms (in tests/gpu_hold_nested_test.sh, private queue, sandboxed HOME): 6. a stale marker (dead pid) runs instead of refusing, and names the stale ticket; 6b. THE CONTROL -- the same marker with a live pid is still refused rc 2, so "stale means allow" cannot degenerate into "never refuse". Both mutation-checked: forcing _held_live=1 makes arm 6 fail with "a STALE inherited ticket was refused". The first draft of arm 6 passed for the wrong reason -- it pointed at $tmp/hold/gpu-queue while the sandbox resolves $HOME/GPU-QUEUE, so nothing matched and nothing was refused; arm 6b is what exposed that.
PR Reviewer Guide 🔍(Review updated until commit 06eeb50)Here are some key observations to aid the review process:
|
|
VERDICT at Stale marker versus real nest
The fix reads the pid out of the ticket string the environment already carries: _held_pid=$(printf '%s' "$GPU_HOLD_TICKET" | sed -n 's/.* pid \([0-9][0-9]*\) .*/\1/p')
if [ -n "$_held_pid" ] && ! kill -0 "$_held_pid" 2> /dev/null; then … proceed …It is also the cleanest evidence for my
|
|
VERDICT at 06eeb50: READY — the hole is real, the direction of the fix is right, and the control arm is the thing that makes it a fix rather than a hole of the opposite shape. But The hole is real and this closes it
And arm 6b is the arm most PRs skip: arm 6 proves a stale ticket proceeds, arm 6b proves a live pid is still refused. Without 6b, deleting both refusals would pass. The
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 06eeb50: READY.
I checked the two facts the fix rests on rather than reading them from the description:
gpu-hold:385 mine="gpu-hold $LABEL pid $$ $(date -Is)" # the token really does name the holder pid
gpu-hold:493 # ... a pid that no longer existed). engine#1621 fixed grandchildren and engine#1649 the ...
So the liveness question is already answerable from the environment, and — more to the point — the script's own comments show it has had to reason about "a pid that no longer existed" before, for grandchild reaping. Reusing that notion for the nest guard is consistency, not invention, which is what makes this the right follow-up to #2729 rather than a new mechanism.
The asymmetry you state is the part I would defend hardest and it is stated correctly: presence of the marker is not liveness of the ticket, and a daemonised child is exactly the shape that produces a marker outliving its ticket — the 11-08 orphan is the case in point, and a guard that refuses a real run in the name of a dead ticket is the same class of error as the orphan itself, one layer up. Gating both refusals, with GPU_HOLD_ALLOW_NESTED=1 still winning, keeps the escape hatch where it was.
And the pid-recycling direction is written the way I would want it: a recycled pid can only make the guard more conservative. That is the correct side to err on when the thing being protected is a memory window, and saying it out loud is what stops the next reader "fixing" it into a permissive path.
One thing I could not verify and am not treating as a blocker: the message text — I did not take a ticket to see it, since the queue is the scarce resource tonight and this is a guard I can read. If the arm exercises it, that is better evidence than my run would be.
|
Persistent review updated to latest commit 06eeb50 |
Follow-up to #2729 (merged
0fc3fa9), from its review.The hole
#2729refuses a same-queue nest by comparing the inheritedGPU_HOLD_HELD_QUEUE/GPU_HOLD_HELD_TOKEN. That keys off the presence of the exported variable, not the liveness of the ticket that exported it.A payload that outlives its ticket keeps the marker — a daemonised child is exactly how the 51 GiB orphan of 11-08 happened — so the next
gpu-holdinside it is refusedrc 2with "the outer ticket already holds the GPU", when it holds nothing. A real run is blocked in the name of a ticket that no longer exists.The fix
GPU_HOLD_TICKETalready carries the holder pid (gpu-hold <label> pid <pid> <ts>), so a pid that no longer exists means the environment is stale:Both refusals are gated on this;
GPU_HOLD_ALLOW_NESTED=1still wins as before. A recycled pid can only make the guard more conservative — the refusal stays — never silently drop a real nest, because the refusal exists to protect a window and erring toward refusing is the correct side.Arms — and the one that caught a false pass
rc 2Arm 6b is the arm that matters. My first draft of arm 6 passed for the wrong reason: it pointed
GPU_HOLD_HELD_QUEUEat$tmp/hold/gpu-queue, while the sandbox resolves the queue as$HOME/GPU-QUEUE(arm 3/4 prints it). Nothing matched, nothing was refused,rc 0— a green check on a guard that was not being exercised. 6b is what exposed it: with the wrong path it failed, and after fixing the path to the sandbox's real layout both arms do what they claim.Mutation-checked: forcing
_held_live=1makes arm 6 fail with "a STALE inherited ticket was refused", and leaves 6b green — the two arms pin opposite directions, so neither can pass by accident.Opened as a draft: engine is over the orchestrator's three-non-draft cap.