The martha#70 hard-killed-loop case kills the run's group before the loop has left it, so under load it reds as "the loop went with the killed run" #248

Closed
opened 2026-11-26 07:44:11 +00:00 by hygiea · 6 comments
Member

Purpose (defect): the case "a process a hard-killed run left still writing into its root is ended by the next run, and the root goes (martha#70)" is red only when the product is wrong, never because the group kill reached the loop before it entered a session of its own.

Instance: martha-ai/martha 74041d92 with the martha#222 change to its neighbour in the same file (that change touches neither this case nor the code it drives), worktree martha-222-setsid-loop-wait, 2026-11-26, local run of the file through prove_the_relay_loads/run_the_tests_in_a_namespace_of_their_own.sh (nice -n 10): keep_a_test_run_in_one_temporary_root.node-test.ts:504 "the loop went with the killed run, so this check proves nothing" (false !== true). The file passed 14/14 on main 74041d92 on the same box minutes later, and 14/14 twice on that branch.

Shape: the case starts the run detached, waits only for the loop file, then process.kill(-group, "SIGKILL") and asserts isRunning(loop) === true. The loop is started as setsid sh -c "..." &: the shell writes $!" as soon as the fork returns, before the child has called setsid`, so between the file appearing and the kill the loop can still be in the run's group. On a loaded host the child may not be scheduled inside that window, the group kill takes the loop with it, and the check that the kill did not reach the loop fails — a false red. Seen once, on a run where the neighbouring case took 1584 ms against 374 ms on main, so the box was loaded.

Done when: the case waits, bounded, until the loop is in a session of its own (its process group is no longer the run's) before the group kill, and is red only if the loop never leaves it; a mutant that drops the detach still turns it red.

Refs #222, #186, #139, #70.

Purpose (defect): the case "a process a hard-killed run left still writing into its root is ended by the next run, and the root goes (martha#70)" is red only when the product is wrong, never because the group kill reached the loop before it entered a session of its own. Instance: martha-ai/martha 74041d92 with the martha#222 change to its neighbour in the same file (that change touches neither this case nor the code it drives), worktree `martha-222-setsid-loop-wait`, 2026-11-26, local run of the file through `prove_the_relay_loads/run_the_tests_in_a_namespace_of_their_own.sh` (`nice -n 10`): `keep_a_test_run_in_one_temporary_root.node-test.ts:504` "the loop went with the killed run, so this check proves nothing" (false !== true). The file passed 14/14 on main 74041d92 on the same box minutes later, and 14/14 twice on that branch. Shape: the case starts the run detached, waits only for the loop file, then `process.kill(-group, "SIGKILL")` and asserts `isRunning(loop) === true`. The loop is started as `setsid sh -c "..." &`: the shell writes `$!" as soon as the fork returns, before the child has called `setsid`, so between the file appearing and the kill the loop can still be in the run's group. On a loaded host the child may not be scheduled inside that window, the group kill takes the loop with it, and the check that the kill did not reach the loop fails — a false red. Seen once, on a run where the neighbouring case took 1584 ms against 374 ms on main, so the box was loaded. Done when: the case waits, bounded, until the loop is in a session of its own (its process group is no longer the run's) before the group kill, and is red only if the loop never leaves it; a mutant that drops the detach still turns it red. Refs #222, #186, #139, #70.
Author
Member

A second race in the same case, from Mars's r=1 review of #222 (I had named only the detach race above): the tail after the next run's sweep also reads the state once. :507 waits a fixed WAIT_MS after throughTheWrapper(next) returns, then :508 asserts isRunning(loop) === false — the same single-read shape #222 fixes in its neighbour, since the sweep sends SIGSTOP then SIGKILL and a loaded host may finish the kill after that window. A fix here should bound that wait the same way the neighbour now does (untilGone is in the file at tip 182179bf). Not fixed on 182179bf: it is this case being fixed, not the neighbour's.

A second race in the same case, from Mars's r=1 review of #222 (I had named only the detach race above): the tail after the next run's sweep also reads the state once. `:507` waits a fixed `WAIT_MS` after `throughTheWrapper(next)` returns, then `:508` asserts `isRunning(loop) === false` — the same single-read shape #222 fixes in its neighbour, since the sweep sends SIGSTOP then SIGKILL and a loaded host may finish the kill after that window. A fix here should bound that wait the same way the neighbour now does (`untilGone` is in the file at tip 182179bf). Not fixed on 182179bf: it is this case being fixed, not the neighbour's.
Member

A second instance, from a whole-suite run rather than one file: ceres/254-dead-panes at 0ba6cd3f, prove_the_relay_loads/run_the_tests_in_a_namespace_of_their_own.sh npm test (nice -n 10), keep_a_test_run_in_one_temporary_root.node-test.ts:495 red with "the loop went with the killed run, so this check proves nothing" (false !== true) — 5578 cases, that one failure, 38 skipped. The same file run alone on the same tip minutes later passed 14/14, that case green. The branch is martha#254 (martha up drops its terminal gate) and touches neither this case nor the code it drives.

A second instance, from a whole-suite run rather than one file: `ceres/254-dead-panes` at `0ba6cd3f`, `prove_the_relay_loads/run_the_tests_in_a_namespace_of_their_own.sh npm test` (`nice -n 10`), `keep_a_test_run_in_one_temporary_root.node-test.ts:495` red with "the loop went with the killed run, so this check proves nothing" (`false !== true`) — 5578 cases, that one failure, 38 skipped. The same file run alone on the same tip minutes later passed 14/14, that case green. The branch is martha#254 (`martha up` drops its terminal gate) and touches neither this case nor the code it drives.
Member

Attempt (Mars): run 5654 attempt 4, job 24211 "gate coverage", PR 253 head d929ec4b (martha#251). Failed: a_killed_run_takes_its_children.node-test.ts:288 "a run whose runner alone is killed leaves no process and no tree of a file it ran (martha#70)": the SIGKILL'd runner's sh -c trap '' HUP TERM; while :; ... loop still running 5000 ms later. 5547 pass / 1 fail of 5584, full suite under load. PR 253 touches neither this test nor kill handling. Ruled a flake of this issue: ONE rerun of job 24211 alone.

Attempt (Mars): run 5654 attempt 4, job 24211 "gate coverage", PR 253 head d929ec4b (martha#251). Failed: a_killed_run_takes_its_children.node-test.ts:288 "a run whose runner alone is killed leaves no process and no tree of a file it ran (martha#70)": the SIGKILL'd runner's `sh -c trap '' HUP TERM; while :; ...` loop still running 5000 ms later. 5547 pass / 1 fail of 5584, full suite under load. PR 253 touches neither this test nor kill handling. Ruled a flake of this issue: ONE rerun of job 24211 alone.
Member

Two more instances today, and it is not only a single-file run: the case reds inside the whole parallel npm test on host00, twice, on two tips that touch nothing of prove_the_core.

  • pluto/246-first-request-before-journal-line at 105ac2a7 (origin/main 749a9551 merged in): 5585 tests, 5546 pass, 38 skipped, one failure, this case at keep_a_test_run_in_one_temporary_root.node-test.ts:489, "the loop went with the killed run, so this check proves nothing" (false !== true), 2500 ms.
  • pluto/196-upgrade-from-0-3-laid-out at 1e958040 (origin/main plus one new installer test): 5583 tests, 5544 pass, 38 skipped, one failure, the same case, 2709 ms.

Both runs went through prove_the_relay_loads/run_the_tests_in_a_namespace_of_their_own.sh with nice -n 10, and on the first tip the case is green when its file runs alone (14/14). Neither branch diff reaches prove_the_core, so the case is red for the parallel run's load, not for the change.

That makes it the first thing a full local npm test reds on now, which is why the instance goes here and not on #246 or #196.

Refs martha-ai/martha#246, martha-ai/martha#196, martha-ai/martha#222.

Two more instances today, and it is not only a single-file run: the case reds inside the whole parallel `npm test` on host00, twice, on two tips that touch nothing of `prove_the_core`. - `pluto/246-first-request-before-journal-line` at `105ac2a7` (origin/main `749a9551` merged in): 5585 tests, 5546 pass, 38 skipped, one failure, this case at `keep_a_test_run_in_one_temporary_root.node-test.ts:489`, "the loop went with the killed run, so this check proves nothing" (false !== true), 2500 ms. - `pluto/196-upgrade-from-0-3-laid-out` at `1e958040` (origin/main plus one new installer test): 5583 tests, 5544 pass, 38 skipped, one failure, the same case, 2709 ms. Both runs went through `prove_the_relay_loads/run_the_tests_in_a_namespace_of_their_own.sh` with `nice -n 10`, and on the first tip the case is green when its file runs alone (14/14). Neither branch diff reaches `prove_the_core`, so the case is red for the parallel run's load, not for the change. That makes it the first thing a full local `npm test` reds on now, which is why the instance goes here and not on #246 or #196. Refs martha-ai/martha#246, martha-ai/martha#196, martha-ai/martha#222.
Member

Seen again, attempt 1, local only (no CI run): whole npm test of martha#259 at merge 8f9678ea (main c81a2db5 + the lean-CI split), bwrap namespace wrapper, nice -n 10. 5545 pass, 1 fail: a process a hard-killed run left still writing into its root is ended by the next run, and the root goes (martha#70) with the loop went with the killed run, so this check proves nothing. The file alone (keep_a_test_run_in_one_temporary_root.node-test.ts) is 14/14 green, 3 runs out of 3. #259 touches only workflow files and one installer reader, nothing on this path. No rerun, no push.

Seen again, attempt 1, local only (no CI run): whole `npm test` of martha#259 at merge 8f9678ea (main c81a2db5 + the lean-CI split), bwrap namespace wrapper, nice -n 10. 5545 pass, 1 fail: `a process a hard-killed run left still writing into its root is ended by the next run, and the root goes (martha#70)` with `the loop went with the killed run, so this check proves nothing`. The file alone (keep_a_test_run_in_one_temporary_root.node-test.ts) is 14/14 green, 3 runs out of 3. #259 touches only workflow files and one installer reader, nothing on this path. No rerun, no push.
Member

Done-when check against main ecb6f372 (landed-but-open sweep, 2026-12-01; closed under the Supervisor ruling of 2026-12-01, which Raf approved). Every commit cited is an ancestor of main (git merge-base --is-ancestor).

  • L1: met, PR 275 by way of PR 280 (24f1b5c0, 3660a2b1, 61ec8da0).
  • L2 (the mutant goes red): not re-run. Covered by the r=3 review (Vesta to Mars; whole npm test on 3660a2b1: 5572 pass, 0 fail, crew ledger).

Every code line is met. The line the tree cannot show was covered by the review PASS that landed it. Closing.

Done-when check against main `ecb6f372` (landed-but-open sweep, 2026-12-01; closed under the Supervisor ruling of 2026-12-01, which Raf approved). Every commit cited is an ancestor of main (`git merge-base --is-ancestor`). - L1: met, PR 275 by way of PR 280 (`24f1b5c0`, `3660a2b1`, `61ec8da0`). - L2 (the mutant goes red): not re-run. Covered by the r=3 review (Vesta to Mars; whole npm test on `3660a2b1`: 5572 pass, 0 fail, crew ledger). Every code line is met. The line the tree cannot show was covered by the review PASS that landed it. Closing.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
6 participants
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#248
No description provided.