Repository navigation
WIP: jobs surface — #2214 subshell start-notice gate + #2203 suspend single-generation stop - #2231
Merged
Merged
Conversation
…e session GNU prints the async start notice through DESCRIBE_PID (execute_cmd.c:609: if (interactive) describe_pid (pid), jobs.c:1947), and every subshell environment clears interactive (execute_cmd.c:1637 execute_in_subshell). notify_async_job_started checked only the session __RUBASH_INTERACTIVE marker, which fork copies carry into subshell environments, so children backgrounded inside ( ), $( ), pipeline stages and process substitutions printed stray [1] <pid> notices (field shape: interactive nvm ls). The notify now also returns early in in_subshell_environment(), the executor's existing model of that boundary. The coproc spawn site registered its job but never notified; GNU prints for coproc too (execute_cmd.c:2580), so it now routes through the same gated notify. Pin: tests/issue2214_job_start_notice_regressions.rs (9 pipe -i sessions; baseline-red on master for the 5 subshell shapes, the brace-group inner spawns, and the coproc case). Refs #2214
…round the executing thread GNU suspend_builtin sends exactly one stop generation, killpg (shell_pgrp, SIGSTOP) (builtins/suspend.def; jobs.c:4737 shell_pgrp), and its single thread dequeues it at the killpg exit. In this multithreaded executor a bare killpg does not stop the RUNNING executing thread promptly (the kernel wakes a sleeping thread to dequeue the process-directed stop; post-suspend commands executed in 28/30 harness runs — the rubash#1474 defect). The #1474 clamp added a thread-directed SIGSTOP after killpg: prompt, but the two pendings coexist — the one the executing thread does not dequeue survives the stop episode and re-stops the group after the first SIGCONT, so fg's single SIGCONT did not resume the shell (14/40 supervised rounds on master; the cli_tests suspend_force flake, 10 CI sightings, and the same lost wakeup recorded in the #1474 pin header per rubash#1637). Linux fix: every OTHER process in the group gets its own process-directed SIGSTOP (enumerated via /proc), and this process stops solely through the thread-directed tgkill — prompt at its own exit path, and as the only in-process generation it is fully consumed by the episode: one SIGCONT resumes. Validated against a two-thread harness and the real binary: 0/40 tail-runs and 0/40 second-CONT, vs 14/40 second-CONT for the master build. Non-Linux unix keeps the #1474 pthread_kill clamp; /proc unavailable falls back to the historical killpg + tgkill path. Pin: tests/issue2203_suspend_single_cont_regressions.rs — 12 supervised rounds alternating pid-/group-addressed exactly-one SIGCONT (baseline-red on master). The cli_tests carrier test is unchanged and passes deterministically now. Refs #2203
caomengxuan666
marked this pull request as ready for review
October 30, 2026 14:11
This was referenced Oct 30, 2026
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.
WIP: jobs-surface pair — two commits, one per issue. Full evidence in the cluster REPORT (kept with the working tree).
Refs #2214 — stray async start notices from subshell environments
GNU prints the start notice via
DESCRIBE_PID(execute_cmd.c:609 —if (interactive) describe_pid (pid), jobs.c:1947), and every subshell environment clearsinteractive(execute_cmd.c:1637 execute_in_subshell). rubash'snotify_async_job_startedchecked only the session__RUBASH_INTERACTIVEmarker, which fork copies carry into subshell environments, so children backgrounded inside( ),$( ), pipeline stages and process substitutions printed stray[1] <pid>notices (field shape: interactivenvm ls).notify_async_job_startednow also returns early inin_subshell_environment().tests/issue2214_job_start_notice_regressions.rs— 9 pipe--isessions. Baseline-red on master: all 5 zero-notice shapes, the brace-group inner spawns, and the coproc case fail; the 2 pure controls pass on both trees. Fixed tree: 9/9.Refs #2203 —
suspend -flost wakeup (cli_tests flake, 10 CI sightings)Characterized as a real product defect, not harness timing. GNU sends ONE stop generation (
killpg (shell_pgrp, SIGSTOP), builtins/suspend.def; jobs.c:4737). In this multithreaded executor:suspend -ftakes effect only after the rest of the script has run (stop is deferred past the builtin) #1474 clamp's additional thread-directed SIGSTOP makes two generations coexist: the pending the executing thread doesn't dequeue survives the episode and re-stops the group after the first SIGCONT — sofg's single SIGCONT did not resume the shell (14/40 supervised rounds on the master build; the [bug]suspend -ftakes effect only after the rest of the script has run (stop is deferred past the builtin) #1474 pin's own header records the same lost wakeup per [test] issue1474 suspend regression pin can hang in sandboxed runs (SIGCONT supervision carrier fragile) #1637, worked around there by re-sending CONT).Fix (Linux): every OTHER process in the group gets its own process-directed SIGSTOP (enumerated via /proc), and this process stops solely through the thread-directed tgkill — prompt at its own exit path, and as the only in-process generation it is fully consumed by the episode. Non-Linux unix keeps the #1474 pthread_kill clamp; /proc-unavailable falls back to the historical path (documented in code).
Validation (Linux, loaded VM): fixed binary 0/40 second-CONT and 0/20 tail-runs; master binary 14/40 second-CONT.
tests/issue2203_suspend_single_cont_regressions.rs(12 rounds, exactly one SIGCONT, alternating pid/group addressing) is red on master, green on the fix; the #1474 timing pin passes 20/20; the cli_tests carrier test is unchanged and passes deterministically (0.14s vs the 10.1s timeout failures).An intermediate sched_yield variant was implemented and rejected by evidence (resume-clean, but the stop landed 1–2 commands late in 7/30 runs, regressing #1474) — the ladder of measured variants is in the commit message and code comments.