Repository navigation
fix(jobs): reader-boundary notice pass retires without a retained link (Refs #4288) - #4290
Merged
Merged
Conversation
…k (Refs #4288) Refs #4288 (not Fixes). A background death observed by an intervening foreground wait was printed at the wait builtin's own reader boundary, and the boundary emit's cleanup retired the job but also populated the #2777 retained link (completed_job_pids) -- so `kill -KILL %1; sleep 0.3; wait %1` answered 137 from the link where GNU answers 127 + `no such job`. GNU's pull-driven notify_and_cleanup (parse.y shell_getc) deletes the row in the same pass it prints the notice; no jobspec record survives for the list being read. Give the cleanup a no-link form and use it for exactly the reader-boundary pass: cleanup_dead_jobs delegates to a shared cleanup_dead_jobs_impl(retain_link); the boundary report (report_pending_signal_notices_at_line, the #2928 stamped flush) routes through a new report_pending_signal_notices_ no_link / emit_signal_notices_with_link pair. Print timing, stamps, marking, and deletion are unchanged -- only the link insert is skipped. Mid-list retirements (the `jobs` builtin's notify, a wait's own tail cleanup, the stream-end flush) keep the link: there a following wait in the same list is the reap's peer (#2777 cells). Net lines: +50/-3 (2 production files; no test files -- the pin already exists and was red on master). Nothing deleted: the link mechanism stays for its mid-list domain; the boundary pass now uses the same single cleanup impl with the record left unpopulated, so there is no second path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #4288 — UNVERIFIED-BY-CAPTAIN
Root cause
kill -KILL %1; sleep 0.3; wait %1answered 137 on master; GNUanswers 127 +
wait: %1: no such job(oracle-verified againstbash 5.3.20, 3/3). The death is observed by the intervening
foreground wait, so at the
waitline's reader pull the boundarystep (ast_exec flush, #2928) prints the notice, marks the job
notified, and its cleanup retires the entry — but that cleanup also
populates the #2777 retained link (
completed_job_pids), andwait's NoMatch arm consults the link and answers the saved status.GNU's pull-driven
notify_and_cleanup(parse.y shell_getc) deletesthe row in the same pass that prints the notice; no jobspec record
survives for the list being read. The link over-approximates GNU:
its legitimate domain is retirements driven mid-list (the
jobsbuiltin's own notify, a wait's tail cleanup), where afollowing wait in the same list is the reap's peer — the #2777
cells. A retirement driven by the reader pull itself is not one
of those.
Fix
One shared cleanup, one flag:
jobs/table.rs:cleanup_dead_jobsdelegates tocleanup_dead_jobs_impl(retain_link); newcleanup_dead_jobs_no_link()passesfalse(the entry-pointcompleted_job_pids.clear()— link expiry — is unchanged).executor/job_builtins.rs:emit_signal_noticesdelegates toemit_signal_notices_with_link(notices, retain_link); newreport_pending_signal_notices_no_link(); the reader-boundaryflush
report_pending_signal_notices_at_line(both ast_execcall sites) routes through the no-link form.
Print timing, line stamps, J_NOTIFIED marking, and deletion are
all unchanged — only the link insert is skipped for the boundary
pass. Mid-list and stream-end passes keep the link.
What this PR deletes: nothing. The link mechanism stays for
its mid-list domain; the boundary pass uses the same single
cleanup impl with the record left unpopulated — no second path
is introduced.
Net lines: +50/−3 (2 production files; no test files — the
pin already exists and was red on master).
Approach considered and rejected (with evidence)
Moving the print itself to the foreground-wait notify point
(the original lane patch, +37/−1) fixes the wait outcome but
regresses the notice's placement and stamp: it prints before the
rest of the intervening list runs and stamps the just-finished
line (3), where GNU prints at the pull stamped with the upcoming
line (4). Evidence: three
issue2769stamp pins(
boundary_notice_stamps_the_next_commands_line,…_the_first_line_read_after_the_death,eof_notice_stamps_one_past_the_last_line) went red, and amarker probe (
sleep 0.3; echo MARKERon the intervening line)showed the notice ahead of
MARKERwhere the oracle prints itafter. The codebase's own #2928 comments already record this
GNU model; this PR leaves the print exactly where it was.
Verification (lane, devin-mac, base = master
ef4ea1b0, realtarget/debug/rubashthroughout — never thebashshim)waitrc=1376/6,one notice (stamp line 4), no
no such job.waitrc=127+no such job6/6,one notice, stamp still line 4.
/bin/sleep 0.3variant 127 6/6;echo SEPinterposed 127 3/3; marker shape:MARKER, then thenotice (line 4), then
no such job,waitrc=127— ordering,stamp, and outcome all identical to the oracle. One-line form
(
kill …; sleep 0.3; wait %1in one list) stays 137 6/6, alsomatching GNU (the wait drain reaps mid-list; no pull retires).
127 / SEP 127 / one-line 137 / stopped-then-killed E5 127 /
interactive expire cell without an intervening echo (PTY):
W=127,W2=127— the fixed binary matches on every face.issue2698_job_death_notice_retirement_regressions: 5/5(was 4/5 on master; the boundary test is the census red this
fixes).
issue2769_death_notice_line_stamp_regressions: identical tobase on this host (the 3 boundary/EOF stamp tests pass; the 2
remaining reds are pre-existing environment failures, identical
name set on base).
issue2777_stopped_job_state_regressions: identical name setpatched vs base (both link cells pass; the 6 other reds are
pre-existing devin-mac environment failures — BSD
scripthasno
-c, no controlling terminal — identical on base).2000_2299 / 2300_2499 / 2500_2699 / 2700_2799 / 3400_3599 plus
the wait/jobs/notice standalone suites, run patched and on
base on devin-mac): no unexplained delta. The only
patched-vs-base differences were load flakes in signal-timing
modules (issue2134 ×5, issue2346/2348/2352/2353 ×7), each of
which passes on the patched tree in a quiet filtered re-run;
the remaining local reds are identical environment failures on
both sides, and
issue2488's stopped-job wait test hangs onthis host on both sides. Full-census differential is left to
this PR's CI.
Residuals (deliberately out of scope)
jobsbuiltin's own notify pass and the stream-end flushstill retire with the link (unchanged). A
wait %Nafter ajobs-printed notice therefore still resolves through thelink; that face is unprobed against GNU and unchanged by this
PR — recorded here for the captain's call.
wait_with_outputcapture waitare untouched, as before.
GNU itself (the jobs: stopped (SIGSTOP) job reported as Running; checkjobs wording follows wrong state [B4 obs] #2777 test pins W1 ∈ {137, 147}); this PR does
not change its in-suite behavior (the cell passes, identical
name set).