Skip to content

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

Closed

Description

@scuttletoby

Follow-ups from the two reviews of #687 (both SAFE): #687 (comment) and #687 (comment)

Tests missing (major in lens B)

  • No test pins the guard's setsid (fork-kit/heavy/bin/heavy:379): removing it leaves all tests green, yet a kill -9 -PGID of heavy (how timeout and harnesses kill) then leaves a process and a container behind.
  • No test covers container removal on the signal path (bin/heavy:773: command outlives the grace time, or a second signal).
  • Also unpinned: the guard ignoring signals, the parent-gone refusal, kept scopes getting no guard, and the exact-label check (the fake ps already filters exactly).

Hardening (minor)

  • heavy docker-label prefers HEAVY_SCOPE over the process's real scope: a process that left the scope but kept the variable still gets heavy's label.
  • stop_scope's by-hand kill signals pids one at a time (pid reuse); writing cgroup.kill closes that gap.
  • A tree-kill (pkill -9 -P, npm tree-kill) also kills the guard; leftovers then wait for the sweep (a leak, not a wrong kill).
  • Rootless Docker reached only through docker context use counts as no Docker, silently.
  • The sweep accepts HEAVY_DOCKER without the absolute-path check bin/heavy has.
  • Every heavy run calls docker ps; with socket-activated Docker that starts a stopped daemon, and a hung daemon slows every run's end. Consider only checking when the scope labelled a container.
  • fork-ci-tests.txt weight for the heavy tests is ~52s; CI took 37 s.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions