Repository navigation
fix(microvm-worker): the orphan sweep's log says how many swept cgroups held a live VM - #849
Conversation
The orphan sweep's startup line, "swept N VM cgroup(s) from a previous incarnation", counts cgroup directories removed. A VM process that was still running and had to be SIGKILLed and an empty pool directory left by a clean shutdown each add one, so an operator cannot tell a leaked VM from housekeeping. SweepResult gains Killed, the swept directories whose cgroup.procs listed a process still running when it was signalled, and a Summary method the worker now logs: swept N VM cgroup(s) from a previous incarnation: K held a live process (killed), M were empty; left alone S non-VM cgroup(s) [...] What the sweep signals, waits for and removes is unchanged; Swept keeps its meaning, so settleSweep's decision is unchanged too. Assisted-By: Claude Code Signed-off-by: Rong Chang <[email protected]>
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Summary
SweepResult gains Killed, set by the new cgroupSweptLive outcome when some pid in a swept directory passed pidStillRunning (kill -0, or EPERM) just before its SIGKILL. The startup log goes through SweepResult.Summary(). Signal, wait and rmdir behavior are unchanged, and Swept keeps counting both kinds, so settleSweep (which reads only Swept/Stuck) is unaffected. The Windows stub returns false, which is fine for a log-only count. The new test covers live, empty and already-exited directories. No issues found.
Author: webchang (MEMBER — maintainer)
Areas reviewed: Go (remote-worker vmpool, microvm-worker)
Agent/IDE config (.claude/.vscode): none
Commits: 1, all signed-off: yes
CI status: all green (17 checks)
Brings 25 upstream merges since 1aa8dd6, among them the sbx OIDC identity provider (rossoctl#851), the Redis schema-version key and config bundle format marker (rossoctl#868), the provisioner Redis ACL user (rossoctl#869), the relay keepalive env (rossoctl#866), the per-source OIDC pending bound with the forwarded-headers Route pin (rossoctl#874), the egress refusal hints and control-plane index (rossoctl#864), the empty-workspace sweep (rossoctl#872) and the orphan-sweep log split (rossoctl#849). No conflicts. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Rong Chang <[email protected]>
microvm-worker: the orphan sweep's startup line now tells a killed VM apart from an empty cgroup directory.
What changed and why
orphan sweep: swept N VM cgroup(s) from a previous incarnationcounts cgroup directories removed (SweepResult.Swept). A VM process still running that the sweep had to SIGKILL, and an empty pool directory a clean shutdown left behind, each count as one, so an operator reading the log cannot tell a leaked VM from housekeeping.SweepResultgainsKilled: the swept directories whosecgroup.procslisted at least one process still running (pidStillRunning) when the sweep signalled it.sweepOneCgroupreports such a directory with a new outcome,cgroupSweptLive.SweepResult.Summary()formats the line, andcmd/microvm-workerlogs it:orphan sweep: swept N VM cgroup(s) from a previous incarnation: K held a live process (killed), M were empty; left alone S non-VM cgroup(s) [...]Sweptkeeps its meaning (it still counts both kinds), sosettleSweep's decision to wait for held jails is unchanged. A pid that exits on its own between the liveness check and the signal is counted as killed, the safe side for a line meant to say a VM may have been alive.Tests
TestSweepOrphansSummaryTellsAKilledVMFromAnEmptyDirectory(remote-worker/internal/vmpool/cgroup_test.go). A fake slice holdsvm-12with a real live child process,pool-0with an emptycgroup.procs, andvm-13listing the pid of a child that has already exited. It asserts the live child is reaped,Swept = 3,Killed = 1, and the exactSummary()line (1 held a live process (killed), 2 were empty).res.Killed undefined/res.Summary undefined; main has no way to report the split.livenever set):Swept = 3, Killed = 0; want 3 swept, 1 of them holding a live process, FAIL.go vet ./...,GOOS=linux go vet ./...,GOOS=linux go test -cforinternal/vmpoolandcmd/microvm-worker, andGOOS=windows go build ./internal/vmpool: clean.go test -race -count=1 ./internal/vmpool ./cmd/microvm-worker: ok.go test -count=1 ./...inremote-worker: ok.Every commit is signed off (DCO).
Assisted-By: Claude Code