Repository navigation
fix(minimald): fork a task run's container on the sandbox fork thread, not a runtime worker - #2572
Conversation
…, not a runtime worker hakoniwa arms `PR_SET_PDEATHSIG(SIGKILL)` in every container it forks, and Linux delivers that signal when the forking *thread* exits. #1748 moved the session launch and `Sandbox::run_with_cancel` onto `sandbox::forker`'s never-retired thread for exactly that reason, but the task-run path in `exec.rs` kept forking its container on whichever tokio worker ran the exec. Any `block_in_place` on that worker (a later activation's `configure_loadout`) displaces it, tokio retires it after its 10 s keep-alive, and every idle task session forked on it dies: hakoniwa reports the container's death as exit 125, with no client disconnect, which is the signature in every lab run of inbox#710. The spawn goes through `on_fork_thread` like the other two. Nothing else changes: the caller still blocks for the fork-and-exec handshake as it did inline. Refs: gominimal/inbox#710, #1748 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Move task spawning to the fork thread crates/minimald/src/exec.rs |
Task invocation uses sandbox::forker::on_fork_thread to run cmd.spawn(). The existing command-launch error mapping remains unchanged. |
Priority:
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix
Possibly related issues
- Box — one record, one spec, one grammar for every session and task on a stock install #2236: The change updates task process spawning, which supports the issue’s task lifecycle objective. It does not implement the full epic.
- gominimal/inbox#710: The change uses the sandbox fork thread for task spawning. The issue’s evidence does not establish that worker-thread retirement caused the reported session kills.
Merge Risk: 
Minimal · up to 89350
-
The task spawn is moved to the intended fork thread without an identified functional regression.
Pre-merge checks: 
3 · 
2
-
Failed checks: 2 warnings Passed checks: 3 passed-
Full details: Title check
-
Explanation
Title passes. It uses Conventional Commit format,
fix(minimald): ..., and states the main change: the task run container is forked on the sandbox fork thread instead of a runtime worker. The title matches the summary and objectives. It is 91 characters long and does not identify the PDEATHSIG cause, but it remains specific and accurate.
Full details: Out of Scope Changes check
-
Explanation
The only code change moves the task-run
cmd.spawn()call tosandbox::forker::on_fork_threadand documents thePR_SET_PDEATHSIGfailure mode. This directly supports the pull request objective and the reported#710symptom. No unrelated implementation change is shown.
-
Full details: Description check
-
Explanation
Description fails because it is incomplete. It includes Summary and Testing sections. The Summary explains the cause, including
PR_SET_PDEATHSIGand fork-thread exit, describes the fix, and linksgominimal/inbox#710. The Testing section lists formatting, Clippy, workspace tests, a lab scenario with results, and the reason no unit test was added. The template Checklist section is missing. The description does not state whether documentation was updated or whether the change is breaking. It also lacks aCloses:orRefs:line forgominimal/inbox#710.Resolution
Add the Checklist section from the repository template. State whether documentation was updated. State whether the change is breaking. If the repository requires issue-reference keywords, add
Closes: gominimal/inbox#710orRefs: gominimal/inbox#710.
Full details: Linked Issues check
-
Explanation
The change in
crates/minimald/src/exec.rsmoves task-container spawning tosandbox::forker::on_fork_thread. The reported lab results support this as a fix for the reproduced task-session failure. However, open issue#710also identifies two coding follow-ups: extend incident-timekmsgdiagnostic coverage and clear or mark session records after abnormal death. This pull request changes neither diagnostic collection nor session-record handling. The issue does not establish that the original incident had this cause, so the lab result does not replace those stated coding requirements.Resolution
Implement the
#710diagnostic-coverage and abnormal-session-state changes, or provide updated issue requirements that explicitly limit#710to the fork-thread fix.
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
A rabbit watched the task take flight
From fork-thread paths into the night
The spawn call hopped along its way
Its error map stayed just the same
Then soft paws stamped the diff: “All right!”
Comment @coderabbitai help to get the list of available commands.
|
Reviewed: 1 finding, none blocking at Address the comments on the diff. Clobber: none seen. |
…#2572) hakoniwa arms PR_SET_PDEATHSIG(SIGKILL) in every container it forks, and Linux delivers that signal when the forking thread exits. The task-run path in exec.rs forked its container on whichever tokio worker ran the exec. Any block_in_place on that worker displaces it, tokio retires it after its 10 s keep-alive, and every idle task session forked on it dies with exit 125. The spawn now goes through on_fork_thread, as the session launch and run_with_cancel do. Backport of #2572. Adapted to the line: sandbox:: reads sandbox2::. (cherry picked from commit cafa674)
…#2572) hakoniwa arms PR_SET_PDEATHSIG(SIGKILL) in every container it forks, and Linux delivers that signal when the forking thread exits. The task-run path in exec.rs forked its container on whichever tokio worker ran the exec. Any block_in_place on that worker displaces it, tokio retires it after its 10 s keep-alive, and every idle task session forked on it dies with exit 125. The spawn now goes through on_fork_thread, as the session launch and run_with_cancel do. Backport of #2572. Adapted to the line: sandbox:: reads sandbox2::. (cherry picked from commit cafa674)
Summary
Fixes gominimal/inbox#710: idle task sessions SIGKILLed together, seconds after unrelated activity.
Mechanism. hakoniwa arms
PR_SET_PDEATHSIG(SIGKILL)in every container it forks, and Linux delivers that signal when the forking thread exits. #1748 moved the session launch andSandbox::run_with_cancelontosandbox::forker's never-retired thread for that reason. The task-run path inexec.rswas the third spawn site, and it kept forking a task's container on whichever tokio worker ran the exec. A laterblock_in_placeon that worker (an activation'sconfigure_loadout) displaces it, tokio retires it after its 10 s keep-alive, and every idle task session forked on it dies. hakoniwa reports the container's death as exit 125 (Child::FAILURE, "the Container itself fails"), with no client disconnect.Fix. The task-run spawn goes through
on_fork_threadlike the other two. One line plus a comment; the caller still blocks for the fork-and-exec handshake as it did inline.Evidence
The lab scenario
710-pdeathsig-sibling-kill(four idlemin task runsessions, eightmin session activates, 25 s idle, six rounds per cell) fails on every main built this week: 18 of 18 cells onccc4f95c(six distros, three rounds, anvil job 01243), and onfb92f871,608ab9c9and230709d3before it. In every killed session the forking thread is aminimald-workerthat is gone by the time of the check, neversandbox-fork. The daemon log of one cell (arch, round 3):With the fix, on the same main (
230709d3), six distros, three rounds, anvil job 01257:A family check (690, 690b, 710d, 710g, 732, 789b, 789t, 789y, 789z on four distros, two rounds; job 01258) is 32 / 32 on both, so nothing else in the exec and teardown paths moved.
Testing
just fmt-check,just clippy, and the workspace tests on anvil throughprepush.sh(the CI mirror); the only failure is the environment-onlysandbox::caps_root_integration::boxes_lack_cap_net_raw.sandbox::forker's tests (a_fork_on_the_fork_thread_outlives_the_caller), and proving the task path uses it needs a real sandbox, which is what the lab scenario does.🤖 Generated with Claude Code
Summary by CodeRabbit