Repository navigation
Description
Two follow-ups observed while clearing the bare-metal box after the authoritative E10/E11
runs (PR #251). Neither affected a measurement, and neither is a data or process leak — both
are hygiene/guidance items deliberately left out of that PR because they were outside its
scope.
1. Two empty directories leak per VM id, unbounded across runs
firecrackerVM.Destroy removes the jail contents correctly, but one level too deep:
// launcher_firecracker.go:218
jailRoot := filepath.Join(l.opts.ChrootBase, filepath.Base(l.opts.FirecrackerBin), req.ID, "root")
// launcher_firecracker.go:692 (in Destroy)
if err := os.RemoveAll(v.jailRoot); err != nil { … }jailRoot is <ChrootBase>/firecracker/<id>/root, so Destroy reclaims everything inside
but leaves the per-VM parent <ChrootBase>/firecracker/<id> behind as an empty directory.
Separately, the per-VM cgroup directory is created by jailer (via --cgroup) and is removed
only by SweepOrphans → removeCgroupDir. Nothing on the normal destroy path rmdirs it,
so a clean shutdown also leaves one empty cgroup dir per VM id.
Measured on metal after two E10 runs (ITERS=200) plus one 14-rung E11 sweep:
| leftover | count | content | size |
|---|---|---|---|
/srv/jail/firecracker/vm-N/ |
3007 | 0 of 3007 held any content | ~12 MB of inode |
/sys/fs/cgroup/microvm.slice/microvm-vms.slice/vm-N/ |
3007 | 0 procs in all 3007 | — |
So the reclamation that matters works: no VM data, no processes, nothing to attribute to a
run. What accumulates is ~4 KB of inode per VM id, and VM ids are minted monotonically, so it
grows without bound across runs on a long-lived host.
The METAL-RUNBOOK.md §3a preflight already clears both, so the operational path is covered
and no run is at risk. Suggested fix: have Destroy remove the per-VM parent dir rather than
<id>/root, and rmdir the per-VM cgroup on the normal destroy path (keeping SweepOrphans
as the orphan backstop, not the only reaper). Note the cgroup half must stay rmdir, never
rm -rf — see the D5 note in cgroup.go:359.
2. Probing jail internals: expand globs inside the privileged shell
A verification hazard rather than a defect, worth a caution in §3a because that section is
where preflight checks get extended.
$ sudo ls -1d /srv/jail/firecracker/vm-* -> 0 directories
$ sudo find /srv/jail -maxdepth 3 -name 'vm-*' | wc -l -> 3007
The shell expands vm-* before sudo runs. jailer creates
/srv/jail/firecracker as drwx------ root, so an unprivileged shell matches nothing and
hands sudo ls the literal unexpanded pattern — which then reports an absence. Adding sudo
to the front of the command does not fix it, which is why it survives review. I briefly drew
the wrong conclusion ("0 of 3007 jail dirs hold content") from a probe that had enumerated
nothing at all; the corrected probe gave the same answer for a real reason.
The shipped commands are correct and need no change — I checked. §3a's
sudo rm -rf "$SH_WORKSPACE_ROOT"/* /srv/jail/firecracker works because /srv/workspaces is
drwxr-xr-x (verified empirically on the box: the glob expands, the decoy dir is removed),
and the jail path carries no wildcard. The hazard is confined to paths jailer creates at
mode 0700 — i.e. anything under /srv/jail/firecracker/<id>/.
Suggested fix: one caution in §3a — when probing jail internals, glob inside the privileged
shell (sudo bash -c '…') or let a privileged walker expand it (sudo find), and treat an
absence reported by an unprivileged glob as unproven. This is the same family as the existing
[ -S "$sock" ]-reads-absent and kill -0-reads-dead artifacts already documented on the
branch.
Context: both were found on 2026-09-15 while returning srv-r16b14s16 to a clean state after
the metal run. The box is left provisioned (toolchain + verified golden snapshot) so a rerun
is git fetch + reset rather than a rebuild.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
pdettori commentedon Sep 17, 2026
Epic: rossoctl/rossoctl#2546 (Stream 2 — microVM sandbox tier, via sub-epic rossoctl/serverless-harness#256)
Status update (2026-09-17)
Still open, no PR yet. Filed after #251 (P4 microVM sandbox
tier) merged; no change since.
Assisted-By: Claude (Anthropic AI) [email protected]
pdettori commentedon Sep 21, 2026
Escalation: the leaked cgroup dirs are not hygiene — measured 5.3x throughput collapse
This issue states that neither leak "affected a measurement" and that both are
"hygiene/guidance items". The cgroup half of it is a progressive throughput defect, and it
has now invalidated a measurement campaign (see #305).
Measured causally
Same host (
srv-r16b14s16), same worker, same configuration throughout — one microVM worker,16 concurrency slots, 400 iters/slot, D=2, 256 MiB guests:
vm-*cgroups at startsockwaitmeanfind /sys/fs/cgroup/microvm.slice -depth -type d -name 'vm-*' -deleteand nothing elserecovered 5.3x. Peak observed on the box was 47,940 stale directories.
Mechanism
Cgroup creation and destruction are serialised in the kernel, and cost grows with how many
exist. A
jailer-created cgroup that takes longer to set up delays the point at whichFirecracker binds its API socket, so the cost lands in
waitForUnixSocket— the restoresub-phase that is already 90% of a restore (#304). Restores are how the standby pool
replenishes, so it becomes an aggregate throughput ceiling.
The signature is distinctive and worth recording for whoever meets it next: throughput
collapses while the host goes idle (88% idle at the worst point). Nothing is computing;
everything is waiting on cgroup operations. A CPU-based diagnosis will look clean and find
nothing.
Why it is not confined to a test rig
Destroyis the normal path, not an error path, so one cgroup leaks per Exec for thelifetime of the worker process.
SweepOrphansonly runs at startup, so a long-livedproduction worker degrades monotonically and is only repaired by a restart. At ~50,000 Execs the
effect is already 5x. Nothing bounds it.
Suggested change
Have the normal destroy path rmdir the per-VM cgroup, reusing the existing
removeCgroupDirthatSweepOrphansalready calls (D5's "rmdir, never rm -rf" applies — theseare kernel-backed pseudo-files). The empty
<ChrootBase>/firecracker/<id>parent dir from part 1of this issue is worth fixing in the same pass, though only the cgroup half has a measured
throughput cost.
I would also drop the "small / fold into whichever Phase 3 task is nearby" framing from the
campaign plan: on this evidence it outranks the
Destroydecomposition it was going to befolded into.
pdettori commentedon Sep 21, 2026
Fixed in PR #314, verified on metal
Following the escalation above, the cgroup half of this issue is fixed:
Destroynow rmdirs theper-VM cgroup, reusing the same
removeCgroupDirthatSweepOrphanscalls.Verified end to end on
srv-r16b14s16— one worker, 16 slots, 400 iters/slot (6,497 restores),identical configuration on every row:
sockwaitmean0 directories after 6,497 restores. And 1.34x even on a run that starts clean, because the
leak degraded a run as it proceeded — that middle row had accumulated 6,497 of its own by the end.
A side effect worth recording here: with the leak gone,
sockwaitp50 is 21.08 ms, i.e. backat the fixed 20 ms poll quantum. Most of what looked like "restores get slower under concurrency"
was this leak, so #304 is now cleanly the next bottleneck instead of being tangled with it.
Part 1 (the empty
<ChrootBase>/firecracker/<id>parent dir) is deliberately left open — real, but~4 KB of inode with no measured throughput cost. Worth keeping this issue open for it, or splitting
it out.
fix(vmpool): remove the per-VM cgroup on the failure path too (rossoc…
fix(vmpool): rmdir the per-VM cgroup on the normal destroy path (#255)
Merge pull request #314 from pdettori/fix/255-destroy-removes-vm-cgroup
perf(vmpool): poll finely for the API socket instead of a fixed 20ms …
docs: publish the Exec/s campaign results and preserve #303's dead ends
docs(vmpool): measure the restore+destroy ceiling at ~870/s; my suppl…
feat(vmpool): a bounded reaper that opens execGate at the barrier, no…
docs(vmpool): measure the restore+destroy ceiling at ~870/s; my suppl…
feat(vmpool): a bounded reaper that opens execGate at the barrier, no…
docs(vmpool): measure the restore+destroy ceiling at ~870/s; my suppl…
feat(vmpool): a bounded reaper that opens execGate at the barrier, no…
docs(vmpool): measure the restore+destroy ceiling at ~870/s; my suppl…
feat(vmpool): a bounded reaper that opens execGate at the barrier, no…