martha#356: kill the frozen tree deepest first, through an injected kill and pgrep #359

Manually merged
terra merged 1 commit from saturnus/356-kill-deepest-first into main 2026-12-01 14:29:16 +00:00
Member

Purpose (fix): a child that a run forks while it is being torn down no longer escapes killEvenIfGone.

Refs #356 (the cause and the counts are in c7294)

  • Cause: the walk froze the tree top down and killed it in the same order. Killing the wrapper first lets its stopped run continue (SIGCONT), and the run forks a child the walk never read. That child is orphaned, and no refusal is logged.
  • Fix: the frozen processes are killed deepest first, so each one dies while its parent is still stopped.
  • Seam first: the walk's kill and pgrep are now an injected Reach, defaulting to this machine's. The new case uses a made-up pid tree, a kill that records and sends nothing, and a fake pgrep, so no signal from it reaches any process. It checks that the whole tree is frozen before any kill, that only those pids are signalled, and that each child dies before its parent. On the old order it is red: "pid 101 is killed before its parent, pid 100".
  • msi00, the installer job's image, 4 containers at once:
    • escape reproduction, 1600 runs on this tip: 0 SIGCONT and 0 live escapes. Two runs left only a zombie session leader waiting to be reaped. Main's order: 31 SIGCONT and 1 live orphan in 1600.
    • the #340 case alone: 480 of 480 green.
    • whole file, 3 × 8: 24 of 24 green. Main was 23 of 24.
  • Whole npm test in its own namespace: green (installer 170 of 170; src 5921 pass, 0 fail, 38 skipped as on main).
  • No timeout raised, no retry, no new check.
Purpose (fix): a child that a run forks while it is being torn down no longer escapes `killEvenIfGone`. Refs #356 (the cause and the counts are in c7294) - Cause: the walk froze the tree top down and killed it in the same order. Killing the wrapper first lets its stopped run continue (SIGCONT), and the run forks a child the walk never read. That child is orphaned, and no refusal is logged. - Fix: the frozen processes are killed deepest first, so each one dies while its parent is still stopped. - Seam first: the walk's `kill` and `pgrep` are now an injected `Reach`, defaulting to this machine's. The new case uses a made-up pid tree, a `kill` that records and sends nothing, and a fake `pgrep`, so no signal from it reaches any process. It checks that the whole tree is frozen before any kill, that only those pids are signalled, and that each child dies before its parent. On the old order it is red: "pid 101 is killed before its parent, pid 100". - msi00, the installer job's image, 4 containers at once: - escape reproduction, 1600 runs on this tip: 0 SIGCONT and 0 live escapes. Two runs left only a zombie session leader waiting to be reaped. Main's order: 31 SIGCONT and 1 live orphan in 1600. - the #340 case alone: 480 of 480 green. - whole file, 3 × 8: 24 of 24 green. Main was 23 of 24. - Whole `npm test` in its own namespace: green (installer 170 of 170; src 5921 pass, 0 fail, 38 skipped as on main). - No timeout raised, no retry, no new check.
killEvenIfGone froze the tree top down and killed it in the same order: the wrapper's end hands its stopped run a
SIGCONT, and the run forks a child the walk never read before its own kill lands. Killed deepest first, every process
dies while its parent is still stopped.

The kill and pgrep the walk uses are now a seam (Reach), defaulting to this machine's. The order case drives a made-up
tree through a recording kill, so none of its signals reaches a process.
terra manually merged commit 15d2b5275a into main 2026-12-01 14:29:16 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
martha-ai/martha!359
No description provided.