Skip to content

heavy: guard tests and hardening from the #687 reviews - #727

Merged
scuttletoby merged 2 commits into
mainfrom
fork/heavy-guard-tests-690
Nov 21, 2026
Merged

scuttletoby merged 2 commits into
mainfrom
fork/heavy-guard-tests-690

Conversation

@scuttletoby

Copy link
Copy Markdown
Owner

What and why

This PR adds the missing tests and the hardening listed in #690, which came from the two #687 reviews. Each item is fixed at its root; none is skipped.

Tests (in fork-kit/heavy/tests/heavy.test.py):

  • setsid pin: a kill -9 -PGID of heavy's process group still lets the guard stop the scope and remove its container.
  • Signal-path container removal: a command that outlives heavy's signal still has its container removed, both after the grace time (TERM) and at a second signal (INT, then TERM).
  • The guard ignores the signals heavy handles (TERM, INT, HUP, USR1, USR2 sent to the guard). It still cleans up after a later kill -9 of heavy.
  • Parent-gone refusal: a command whose heavy died before PDEATHSIG took hold never starts (Parts, no systemd needed).
  • A kept scope gets no guard: a kept heavy killed with -9 keeps its daemon.
  • Exact-label check: the fake docker ps can now match on the key only (psMatchesKeyOnly), so heavy's own exact check is what keeps another scope's container alive.

Hardening:

  • docker-label prefers its real cgroup. The process's own cgroup decides. A process that left heavy's scope (systemd-run --scope inside the command) still carries HEAVY_SCOPE, but it now gets the process owner, so heavy no longer removes its container while it still runs. HEAVY_SCOPE is used only when the cgroup cannot be read.
  • No pid-reuse window in the stop by hand. TERM goes through a pidfd, and only after a check that the pid is still in the scope's cgroup. KILL uses the kernel's cgroup.kill, falling back to the pidfd path when it is missing.
  • A tree kill misses the guard. The guard is double-forked, so it is not heavy's child, and a kill that walks heavy's children (pkill -9 -P) no longer reaches it. A pipe handshake lets done() wait until the guard has really finished.
  • Rootless Docker through docker context use counts as reachable.
  • The sweep accepts only an absolute HEAVY_DOCKER, the same rule as bin/heavy.
  • Docker is asked only after a run that labelled a container. heavy docker-label writes a note for the scope in /run/user/<uid>/heavy/labelled/, a folder only that user can write. heavy runs docker ps only when the note exists, then deletes it. Without a usable folder, heavy asks after every run as before, so no container is ever skipped.
  • CI weight of sweep.test.py changed from ~52s to ~37s.

State question

  • Runs again: a rerun of the same test after a kill works, because the container name is free again (existing test). A second forget of a note is a no-op (tested).
  • Stopped half-way:
    • heavy killed with -9: the guard cleans up and deletes the note.
    • Process group or process tree killed: also covered by tests now.
    • Both heavy and its guard killed: the note stays. It is a tiny tmpfs file that only makes the next heavy with the same scope name ask Docker once, and it is cleared at logout or reboot. The leftover sweep still removes the scope and containers.
  • Old, empty or missing store:
    • No runtime folder, or one others can write: heavy asks Docker after every run, as before. docker-label says why it could not write a note, still prints the label, and exits 0. Both cases are tested.
    • Notes from an installed heavy older than this PR are never read, and that heavy asks Docker anyway.
    • A label built by hand from HEAVY_SCOPE (not through heavy docker-label) leaves no note. heavy does not remove that container, and the leftover sweep removes it later. The README only documents heavy docker-label as the way to label a container.

Tests

All suites pass locally:

  • heavy.test.py: 53 tests, with real systemd and HEAVY_REAL_TESTS=1.
  • sweep.test.py: 76 tests.
  • queue.test.py: 70 tests.
  • install.test.py: 16 tests.

Red checks:

  • Against origin/main's code (HEAVY_TEST_BIN set to the old kit's bin/heavy), these tests fail:

    • tree kill
    • Docker asked only when labelled
    • stop by hand never signals a pid no longer in the scope
    • process still in the scope is signalled
    • Docker context
    • marks folder

    With the old heavy_sweep.py, these fail:

    • test_docker_label_names_the_scope_the_process_is_in
    • test_heavy_docker_must_be_an_absolute_path
  • Pins of behaviour origin/main already had. Each was checked by breaking the rule in a copy of bin/heavy, and the test then fails:

    • os.setsid() removed
    • the guard's SIG_IGN loop removed
    • the getppid() != parent check removed
    • a guard given to kept scopes
    • the exact label check replaced by key-only
    • the signal-path clean_containers call removed
  • The sweep's own red check (MUTATIONS) gains entries for "own cgroup first" and "HEAVY_DOCKER absolute".

The tests touch only scopes and containers they start. Containers go through the fake docker, the marks test uses a private folder, and a note a sweep test makes under heavy is removed again.

General vs project

All general. This is the fork-kit heavy tool with no project facts: the paths are the standard /run/user/<uid> and the cgroup v2 root, and no repo, VM or plugin names appear. The only project-adjacent change is the CI weight line in .github/fork-ci-tests.txt. There are no lines in upstream files, and the seam check passes.

Closes #690

🤖 Generated with Claude Code

Tests pin what the guard and heavy's clean-up rely on: setsid (a kill -9 of
heavy's process group), the guard ignoring heavy's signals, the parent-gone
refusal, no guard for a kept scope, heavy's own exact label check, and the
container removal on the signal path (grace time and second signal).

Hardening: the guard is double-forked (a tree kill of heavy misses it); a
stop by hand signals only pids still in the scope (pidfd + cgroup check) and
kills with cgroup.kill; docker-label names the scope it is in, HEAVY_SCOPE
only when the cgroup cannot be read; a Docker context counts as reachable;
the sweep takes only an absolute HEAVY_DOCKER; heavy asks Docker only after
a run that labelled a container. CI weight of sweep.test.py ~37s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@scuttletoby

Copy link
Copy Markdown
Owner Author

Review lens A (wrong kills and wrong removals): SAFE

Head fd0f79ad7e. I read #690, the two #687 reviews it links, and the whole diff against main: bin/heavy, lib/heavy_sweep.py, the tests and the README. CI is green, and the real-systemd heavy.test.py ran 53 tests OK in the root job. I did not repeat the suites locally: the shared box stayed over its load limit for about 30 minutes, and CI already ran all of them at this head.

Blocking: none.
Major: none.

What I checked and found safe

  • Stop by hand: no pid-reuse path left (fork-kit/heavy/bin/heavy:278-296, signal_in).
    • The order is right: pidfd_open(pid) first, then the /proc/<pid>/cgroup check, then pidfd_send_signal.
    • The pid can be reused before the pidfd is opened. Then the pidfd pins the new process, and the cgroup check reads that same process: it is outside the scope, so it is skipped.
    • The pid can be reused after the pidfd is opened. Then the check may read the new process, but the signal goes to the old pidfd, and the kernel returns ESRCH.
    • An unreadable /proc/<pid>/cgroup counts as "not in the scope", so nothing is signalled (fail closed).
    • Only without pidfds (Linux < 5.3 or Python < 3.9) is there a check-then-kill window. The docstring says so.
  • cgroup.kill only ever hits this scope (bin/heavy:299-311).
    • cg is systemd's ControlGroup of this run's own unit. Every caller passes a non-empty cg (:538, :894, :921, :928).
    • The path is <root><cg>/cgroup.kill, with no walk up to a parent. The root cgroup has no cgroup.kill.
    • A process that moved out (systemd-run --scope from inside the command) is not in that subtree, so it is not killed. That matches the new docker-label rule.
    • On a hybrid host, /sys/fs/cgroup<cg> does not exist, so the unified root is used.
  • The marks can only narrow removal, never widen it (bin/heavy:372-412).
    • clean_containers only decides whether to call remove_containers. That function still keeps only containers whose inspected label is exactly uid=<uid>,scope=<this unit> and that came from that ps. The new psMatchesKeyOnly test now pins this.
    • A note written for another job's scope (by a user or a PR test) can only make that job's heavy ask Docker for that job's own containers.
    • A missing or deleted note means "keep". Heavy then leaves the container to the sweep: a leak, not a wrong removal.
    • The folder checks hold: lstat, the owner uid, no group or other write, mode 0700, and O_NOFOLLOW on the note. unlink does not follow links. The note name comes from a validated heavy-*.scope name with no /.
  • The hand-labelled trade-off is safe. A container labelled from HEAVY_SCOPE by hand now stays until the sweep removes it after the scope is gone. Before, heavy removed it at once. Removal now comes later and only by the same rule, so it is never wider.
  • docker-label: own cgroup first (lib/heavy_sweep.py:1151-1164). The label now names the scope the process is really in. A process that left the scope gets the process owner (uid + pid + start time), so heavy no longer removes its container under it. HEAVY_SCOPE is used only when the cgroup cannot be told (no 0:: line, or a cgroup namespace root): the old behaviour, still inside this user's own label space.
  • Docker context (bin/heavy:342-366). This only makes heavy ask a Docker the user already chose. What gets removed is still the exact-label set. A shared or remote context adds only the uid + 32-bit unit-name collision chance that heavy: clean up everything a command started; heavy leftovers names the rest #687 accepted.
  • The sweep's HEAVY_DOCKER (lib/heavy_sweep.py:623-627): a relative value becomes '', which means no Docker and nothing removed. Fail closed.
  • The double-forked guard (bin/heavy:480-529).
    • It still acts at most once, and only on end of file of w. w is O_CLOEXEC, and GroupProbe closes every other fd.
    • Its clean-up targets only its own unit name.
    • The intermediate child is reaped at once, so no guard pid is kept that could later be reused.
    • If the second fork fails, alive_w closes. Then done() returns and heavy's own clean-up stands, so the guard never cleans a scope by mistake.
    • The SIGCHLD the intermediate child raises is harmless: the wait loop uses waitpid(child.pid, WNOHANG) and treats SIGCHLD only as a wake-up.
  • Kept scopes: no guard, and at the end only forget() runs. Containers are kept unless a signal stopped heavy (:929-933), as before.
  • The tests touch only their own things. guards() matches scope-guard and this test's temp folder in the cmdline, so the signal test never signals another job's guard. The tree kill walks only from the test's own heavy pid. Parts changes CGROUP_ROOTS, RUNTIME_ROOT and DOCKER_DIRS only on a freshly loaded copy of the module, and its cgroup.kill is a plain file in a temp folder. Real-systemd runs write and forget notes only for their own random unit names. The sweep's Label test removes the note it makes for the heavy that runs it.

Minor

  1. fork-kit/heavy/bin/heavy:299 (kill_cgroup): cgroup.kill also kills processes of other uids in the scope.
    • The kernel sends that KILL without a permission check. So a sudo or setuid child that the command started inside its scope is now killed. Before, os.kill got EPERM and left it.
    • This is still the job's own scope, so it is not a foreign kill, and it only happens when systemctl stop failed. It is a behaviour change, though, worth half a line in the README's "stops what is left itself".
  2. lib/heavy_sweep.py:1165-1169: a process that left the scope now falls through to the parent check.
    • For the README's own example run from such a process (systemd-run --user --scope sh -c 'docker run --label "$(heavy docker-label)" ...'), the parent is sh. docker-label therefore exits 1 (refused), and docker run gets an empty --label. If Docker accepts that, the container is unlabelled, and neither heavy nor the sweep ever removes it.
    • This is safe for lens A: it is a leak, never a wrong removal. Still, the README line that says "gets the process owner" could add "(or is refused under a shell: pass --owner-pid)".
  3. bin/heavy:283: the no-pidfd fallback still has the check-then-kill window. That is fine as documented. Python ≥ 3.9 on Linux ≥ 5.3 (every supported target) never takes this path.

State question (lens A view)

  • Runs again: each scope name is new, notes are per scope, and a second forget does nothing.
  • Stops half-way:
    • Heavy is killed: the guard forgets the note.
    • Heavy and the guard are both killed: the stale note only makes a later heavy with the same 32-bit name ask Docker once, still with the exact label. It goes at logout or reboot.
  • Old or empty state: there is no runtime folder, or one that others can write. Heavy then asks Docker every time (as on main), and removal stays exact-label. An older installed heavy ignores the notes.

🤖 Generated with Claude Code

@scuttletoby
scuttletoby merged commit aa9bbf8 into main Nov 21, 2026
30 checks passed
scuttletoby added a commit that referenced this pull request Nov 21, 2026
#569: the CI failure tested a merge onto a base from before #560. There, the
test's live() look ran on the fake clock, so its 30 s lock wait passed in no
real time. #560 already moved live() to the real clock. Reproduced: 3 of 50
runs failed on the old base with 8 CPU hogs, 0 of 50 on this branch. The lock
release after SIGKILL is the kernel's flock drop, and tests on main cover it.

#744:
- signal_in signals only through a pidfd; no fallback to kill(pid)
- docker-label notes go to ~/.local/state/heavy/labelled when the /run/user note
  cannot reach heavy; heavy passes the folders it reads as HEAVY_MARKS
- the refusal under a shell after leaving heavy's scope names the cause
- tests: done() waits for the guard; the install test leaves no note; every
  read and wait of a test process has a timeout, checked by an AST test
- README: cgroup.kill reaches sudo/setuid processes; who refuses to start;
  the --value exit code

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
scuttletoby added a commit that referenced this pull request Nov 21, 2026
Tests pin what the guard and heavy's clean-up rely on: setsid (a kill -9 of
heavy's process group), the guard ignoring heavy's signals, the parent-gone
refusal, no guard for a kept scope, heavy's own exact label check, and the
container removal on the signal path (grace time and second signal).

Hardening: the guard is double-forked (a tree kill of heavy misses it); a
stop by hand signals only pids still in the scope (pidfd + cgroup check) and
kills with cgroup.kill; docker-label names the scope it is in, HEAVY_SCOPE
only when the cgroup cannot be read; a Docker context counts as reachable;
the sweep takes only an absolute HEAVY_DOCKER; heavy asks Docker only after
a run that labelled a container. CI weight of sweep.test.py ~37s.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
scuttletoby added a commit that referenced this pull request Nov 21, 2026
#569: the CI failure tested a merge onto a base from before #560. There, the
test's live() look ran on the fake clock, so its 30 s lock wait passed in no
real time. #560 already moved live() to the real clock. Reproduced: 3 of 50
runs failed on the old base with 8 CPU hogs, 0 of 50 on this branch. The lock
release after SIGKILL is the kernel's flock drop, and tests on main cover it.

#744:
- signal_in signals only through a pidfd; no fallback to kill(pid)
- docker-label notes go to ~/.local/state/heavy/labelled when the /run/user note
  cannot reach heavy; heavy passes the folders it reads as HEAVY_MARKS
- the refusal under a shell after leaving heavy's scope names the cause
- tests: done() waits for the guard; the install test leaves no note; every
  read and wait of a test process has a timeout, checked by an AST test
- README: cgroup.kill reaches sudo/setuid processes; who refuses to start;
  the --value exit code

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
scuttletoby added a commit that referenced this pull request Nov 21, 2026
Tests pin what the guard and heavy's clean-up rely on: setsid (a kill -9 of
heavy's process group), the guard ignoring heavy's signals, the parent-gone
refusal, no guard for a kept scope, heavy's own exact label check, and the
container removal on the signal path (grace time and second signal).

Hardening: the guard is double-forked (a tree kill of heavy misses it); a
stop by hand signals only pids still in the scope (pidfd + cgroup check) and
kills with cgroup.kill; docker-label names the scope it is in, HEAVY_SCOPE
only when the cgroup cannot be read; a Docker context counts as reachable;
the sweep takes only an absolute HEAVY_DOCKER; heavy asks Docker only after
a run that labelled a container. CI weight of sweep.test.py ~37s.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
scuttletoby added a commit that referenced this pull request Nov 21, 2026
#569: the CI failure tested a merge onto a base from before #560. There, the
test's live() look ran on the fake clock, so its 30 s lock wait passed in no
real time. #560 already moved live() to the real clock. Reproduced: 3 of 50
runs failed on the old base with 8 CPU hogs, 0 of 50 on this branch. The lock
release after SIGKILL is the kernel's flock drop, and tests on main cover it.

#744:
- signal_in signals only through a pidfd; no fallback to kill(pid)
- docker-label notes go to ~/.local/state/heavy/labelled when the /run/user note
  cannot reach heavy; heavy passes the folders it reads as HEAVY_MARKS
- the refusal under a shell after leaving heavy's scope names the cause
- tests: done() waits for the guard; the install test leaves no note; every
  read and wait of a test process has a timeout, checked by an AST test
- README: cgroup.kill reaches sudo/setuid processes; who refuses to start;
  the --value exit code

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
scuttletoby added a commit that referenced this pull request Nov 21, 2026
Tests pin what the guard and heavy's clean-up rely on: setsid (a kill -9 of
heavy's process group), the guard ignoring heavy's signals, the parent-gone
refusal, no guard for a kept scope, heavy's own exact label check, and the
container removal on the signal path (grace time and second signal).

Hardening: the guard is double-forked (a tree kill of heavy misses it); a
stop by hand signals only pids still in the scope (pidfd + cgroup check) and
kills with cgroup.kill; docker-label names the scope it is in, HEAVY_SCOPE
only when the cgroup cannot be read; a Docker context counts as reachable;
the sweep takes only an absolute HEAVY_DOCKER; heavy asks Docker only after
a run that labelled a container. CI weight of sweep.test.py ~37s.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
scuttletoby added a commit that referenced this pull request Nov 21, 2026
#569: the CI failure tested a merge onto a base from before #560. There, the
test's live() look ran on the fake clock, so its 30 s lock wait passed in no
real time. #560 already moved live() to the real clock. Reproduced: 3 of 50
runs failed on the old base with 8 CPU hogs, 0 of 50 on this branch. The lock
release after SIGKILL is the kernel's flock drop, and tests on main cover it.

#744:
- signal_in signals only through a pidfd; no fallback to kill(pid)
- docker-label notes go to ~/.local/state/heavy/labelled when the /run/user note
  cannot reach heavy; heavy passes the folders it reads as HEAVY_MARKS
- the refusal under a shell after leaving heavy's scope names the cause
- tests: done() waits for the guard; the install test leaves no note; every
  read and wait of a test process has a timeout, checked by an AST test
- README: cgroup.kill reaches sudo/setuid processes; who refuses to start;
  the --value exit code

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@scuttletoby

Copy link
Copy Markdown
Owner Author

(Reposted 2026-11-22 with private details removed; original 2026-11-21.)

Review lens B (state and leaks): SAFE

Head fd0f79ad. I read #690, both #687 reviews, and the whole diff against main. CI is green on this head (15 passed, the rest skipped as expected). I found nothing that kills the wrong thing or loses data. I found nothing blocking or major. Every leak I found is narrow and still ends at the leftover sweep.

What I ran (locally, in a temp worktree, temp names and the fake docker only):

  • heavy.test.py directly (real systemd user manager, HEAVY_REAL_TESTS=1): 53 OK.

  • sweep.test.py 76 OK (1 skipped), queue.test.py 70 OK, install.test.py 16 OK. Each ran under heavy.

  • Red check against main (HEAVY_TEST_BIN = main's bin/heavy): 6 failures and 2 errors, the same set the PR body lists: tree kill, Docker asked only when labelled, the stop by hand (both tests), the Docker context, and the marks folder.

  • Fix lines removed one at a time (copies of bin/heavy): 7 of 8 go red.

    Line removed Test that goes red
    Guard os.setsid() (bin/heavy:494) test_a_kill_9_of_heavys_whole_process_group_leaves_nothing
    Double fork, with the guard kept as heavy's child (:498, :529) test_a_tree_kill_of_heavy_and_its_children_leaves_nothing
    in_cgroup check in signal_in test_a_stop_by_hand_never_signals_a_pid_that_is_no_longer_in_the_scope
    kill_cgroup (KILL always by pid) the same test
    docker_context() in docker_tool test_docker_through_a_context_counts_as_reachable
    labelled() always true test_docker_is_asked_only_after_a_run_that_labelled_a_container
    forget() in clean_containers (:407) that test, plus the kill -9 test (the guard's note)
    The wait for the guard's end in done() (:558) none; stays green (minor 1)

State question

  • heavy killed at each step. I walked each case:
    • Before the guard exists, or between the two forks: the pipe's EOF has the guard clean up a scope that does not exist yet.
    • While the command runs: tested.
    • During heavy's stop_scope or docker ps/rm: the note is still there, so the guard does it again (both steps can safely run twice).
    • After forget() and before done(): the containers are already handled, so the guard skipping Docker is correct.
    • In done(): the guard already has its d.
  • Guard killed alone: done() gets EPIPE (caught), and the alive read returns EOF at once. Both killed: the note stays, a 0-byte file under a unit name that never comes back. The sweep removes the scope and the containers.
  • Run again in the same scope: unit names carry 32 random bits, so a note is never read by a later run. A second forget is a no-op (tested).
  • Container left after a crash, Docker down or slow: the note is deleted even when docker ps fails. The run's own "could not remove" line and the sweep cover it. Docker is now asked only after a labelled run, so a hung daemon only slows those runs.
  • cgroup v1 or no cgroup.kill:
    • kill_cgroup returns False, and KILL goes through the pidfd path.
    • Without pidfds, a plain os.kill runs after the cgroup check.
    • On hybrid systems, CGROUP_ROOTS resolves to /sys/fs/cgroup/unified for both cgroup.procs and cgroup.kill.
    • Paths in /proc/<pid>/cgroup are relative to the reader's namespace, so a process in the scope that is in its own cgroup namespace (a container runtime) is still matched.
  • Old heavy running during the upgrade: the install switches version folders atomically.
    • An old heavy still asks Docker after every run, so nothing is skipped.
    • Only its notes stay behind (tiny tmpfs files, cleared at logout or reboot).
    • The reverse, a new heavy with an old docker-label, cannot happen within one version folder.
  • Leaks of guard processes or scopes: none new. alive_w is O_CLOEXEC and the guard's subprocesses use close_fds, so done() cannot hang on a grandchild of the guard.

What can leak now that main cleaned up. All are minor. Each is left to the sweep and none is a wrong kill:

  • A. A labelled container whose note never reaches heavy. heavy then skips Docker, where main always asked. This happens when:

    • heavy docker-label cannot write the note (a full /run/user tmpfs, an AppArmor-confined caller). It says so on stderr and still exits 0 (lib/heavy_sweep.py:1226).
    • It writes the note into another mount namespace's /run/user (a sandboxed or unshare -m test runner).
    • The label is built by hand from HEAVY_SCOPE. Nothing in the fork or in the game-project repo does that today; I grepped both.

    The PR body covers the third case. The first two are worth one README line next to the hand-built label.

  • B. A process that left the scope but kept HEAVY_SCOPE (lib/heavy_sweep.py:1163) now gets the owner pid of docker-label's parent. For example, a Gradle test worker forked by a daemon that was started outside heavy.

  • C. The guard is no longer reaped by heavy. Init or the nearest subreaper reaps it. systemd, tini, docker-init and containerd-shim all reap. Under a subreaper that never calls wait, each run would leave one zombie. Not seen here; noting it only.

Minor

  1. bin/heavy:558: no test pins the wait for the guard's end in done(). Replacing the while os.read(self.alive, 1) loop with pass keeps all 53 tests green. The tests read stderr with communicate(), which waits for the guard anyway. Main's waitpid gave the same guarantee and was not pinned either. A test could pin it: right after heavy exits with a plain wait(), without reading stderr, check that no scope-guard with the test folder is left.
  2. tests/install.test.py:219 runs the PR's heavy docker-label under heavy, but nothing removes the note it makes. Under the installed (older) heavy, /run/user/<uid>/heavy/labelled/heavy-python3-<hex>.scope stays behind; I removed mine by hand. sweep.test.py already has the cleanup for exactly this case (its Label.setUp). The PR body says "a note a sweep test makes under heavy is removed again", so install.test.py needs the same lines. Harmless once the new heavy is installed.
  3. README.md:65: "and it refuses to start when heavy is already gone" sits in the guard paragraph, but the refusal belongs to the command (child_setup). The guard does the opposite: on EOF it cleans up. Suggestion: "...misses it. The command refuses to start when heavy is already gone." Also, README.md:23, :46 and :79 are longer than the rest of the wrapped text.
  4. tests/heavy.test.py:339, :352, :375: p.stdout.readline() has no timeout. A heavy that blocks before starting the command hangs the test instead of failing it. My first double-fork mutation, without the matching waitpid change, hung for 19 minutes. The same pattern exists elsewhere in the file, so this is optional.

The 37 s estimate: right for CI in general, not for this PR's run.

  • sweep.test.py took 36.9, 36.2 and 36.7 s on recent main runs (once 44.7 s), so ~37s matches main.
  • On this PR's own run it took 66.8 s.
  • Locally, on a busy box, the PR's file and main's took 67.0 and 64.4 s. The two new tests add about 3 s, so the 66.8 s looks like runner noise.
  • It is under the 2x threshold. Rechecking after merge would settle it.
  • heavy.test.py went from about 35 s to 53 s on CI (the new grace-time and kill tests). That file is run by its workflow, so it has no weight to change.

Public diff: no personal paths, host names, VM ids, user names or emails.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

heavy: tests for group-kill guard and signal-path container removal, plus hardening (from #687 reviews)

1 participant