Clean-install and launch tests leave processes and trees on host00 for days: a killed run runs no tear-down #70
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Purpose (defect): no test leaves a process, a session or a tree behind on the machine after its run ends, however the run ends: pass, fail, SIGTERM, SIGKILL or --test-force-exit.
What is left today
Read from /proc on host00, 2026-11-23 ~00:45Z. Every one is reparented to pid 913 and sits in a session of its own, so no walk from a test can reach it any more:
sh -c ... while :; do mkdir -p /tmp/martha-clean-install-test-Dnn4Q7/relay; date > ...script --quiet --return --command /tmp/martha-clean-install-test-RTQGTg/writer.sh /dev/null/bin/sh /tmp/martha-clean-install-test-RTQGTg/writer.shwhile :; do ... sleep 300 & ...loop that writer.sh startednode /tmp/martha-cc-launch-fdnSKy/launcher.tsnode /tmp/m724-NmlUp1/fa319/martha-cc-launch-7ErC7Y/launcher.tsnode /tmp/m724-8PJ1GA/f3a22/martha-cc-launch-UGkx78/launcher.tsnode /tmp/m724-t8dGPI/f7883/martha-cc-launch-epdIK6/launcher.tsTheir trees are still on disk with them: the
martha-clean-install-test-directories hold writer.sh, forker.sh and a relay root being written to, and themartha-cc-launch-homes hold a launcher's files.Why the tear-down never ran
Both files take their processes down in
t.after, and the clean-install file's martha#590 cases walk the session and kill it; the launcher file holds a lifeline pipe (martha#559) that a launcher reads to its end. All of that runs inside the test's own process. When the run is killed, nothing of it runs:t.afternever fires, the shell loop never reads anything, and the processes are reparented away in sessionsscriptmade for them, which no group kill of the test's own group reaches. The tree then stays too, because the code that removes it is in the samet.after.Two things make it worse than a one-off: the forker loop writes a relay root forever, and the launchers ignore SIGTERM (a plain
killdoes not end them), so an operator clearing the box by hand has to reach for SIGKILL.Done when
Not this issue: macula-io/martha#3, the clean-install proof's red with an empty builder screen. Its comments name no leftover process and it flips green on tips that never touch this code, so it stays its own package.
Refs macula-io/martha#559, #590, #724, #3.
The fixture was a fork bomb of its own, and the walk missed what it forked
Raf, as Mars relayed it (2026-11-23): "FFS save the CPU!" — 58,798 orphaned sleeps were found on host00.
The runaway fixture as main has it keeps every child it ever forks:
while :; do sleep 300 & sleep 300 & sleep 0.005; donestarts about 400 processes a second and reaps none, so one run that is killed (and so runs no
t.after) leaves thousandsbehind, and each of them slows the
/procscan behind everypgrepfor every other run on the box.Branch
pluto/70-leaked-processesdoes four things:the oldest. Measured in a container: 8-9 children of the loop and 11
sleep 300processes in total, steady.when that end comes — timeout, session end,
--test-force-exit, SIGKILL — the start stops what it began, kills it withthe children it had at that moment, removes its tree, and lets the wrapper end. The same end the test process itself is
held to (martha#683), one level further out.
SIGSTOPis a request the kernel takes atthe process's next return to user space, and the walk read children as soon as it had sent the stop. A child forked in
that window was in no read, and its parent's death handed it on, out of every later walk — the exact leak this issue is
about, one process at a time. The walk now reads a process's children only once the machine says it is stopped (or
gone), bounded, and refuses by name when the machine cannot say. That answer comes from the host contract's new
stopOf, so the installer restates no/procfield.discriminates: by mutation, reading children before the freeze fails r=1 (30.2 s) and the r=3 record case, dropping
the wait fails the new pin, and dropping the lifeline fails the new martha#70 case with "nothing the start began is
alive once the run has gone".
The launcher half of this issue is #472/#559's own lifeline, which already ends a launch with its run; the four launcher
pids in the table predate it and are that lifeline's business. Nothing here touches it.
A note from the martha#82 fix (PR 95, Mars's fable review, record martha PR 95 c1459). It goes here by Supervisor ruling, as a comment, not a package.
The host contract test now reads the adapter's processes from
thisMachine.processes, so it no longer goes stale when a part is added. One mutant still survives: if the DEFINITION itself losesstopOf(src/linux_process_identity/files_and_processes_on_this_machine.ts), the test stays 35/35 and tsc stays at 0, becausestopOf?is optional (src/host_contract/host_contract.ts:438). The old four-item literal never pinned it either.At
5f67fa11there is no caller ofprocesses.stopOfunder src, prove_the_core or architecture. Whoever adds the caller this issue needs owns the guard the typedef doc names: a caller that needsstopOfrefuses by name when it is absent, with a test that deletesstopOffrom the definition and reads that refusal.Red on host00, twice, not the linked-TMPDIR run's fault (unverified beyond this box)
While proving macula-io/martha#98 on host00 (an ordinary
node --testof a file in this suite, no TMPDIR trickery) thistest went red, and again when run alone:
It passed on the forge runner in the same shape (martha#98's task 5706: the second suite run there had exactly one fail,
the #48 clone-notice test), so this looks host00-local.
pgrepis not the cause:pgrep -Pnames a known child here(procps-ng 4.0.7). Unverified guess: the fixture writes its pid file before its first
sleep 300 &, so on a slow orloaded box
childrenOfTheRuncan read no children yet.