Repository navigation
fix(e11): a dying VMM contributes 0 to Σ PSS, it is not a refusal - #299
Conversation
`pss_bytes_for_pids` refused on a pid that `kill -0` says is alive but whose
address space is already gone. A task inside do_exit()/exit_mmap() keeps its
task_struct until it is reaped, so `kill -0` succeeds, while smaps_rollup passes
`-r` and then fails to read. That took the "live but unreadable" refusal the
function reserves for a live, memory-HOLDING process it cannot read -- and in
`host_signals_snapshot`'s idle-standby-residency poll, where a failed snapshot is
fatal, it aborted a ladder mid-run.
The function's own exit-race comment already prescribes 0 for this case ("a pid
that has already exited between discovery and sampling contributes 0"); `kill -0`
simply cannot distinguish "alive holding memory" from "dying with none".
Measured on bare metal (srv-r16b14s16, 72 cpu, issue rossoctl#291's re-run, 2026-09-20):
firecracker VMMs in D state with an empty cmdline, 4-5 per microvm rung, and the
three-arm ladder died at microvm c=4 on exactly this. Separation was total:
4857/4857 pids whose smaps_rollup read succeeded had a non-empty cmdline, and
171/171 whose read failed had an empty one.
`pid_mm_is_gone` tests an EMPTY /proc/<pid>/cmdline, which is served from the mm
and so reads empty exactly when that mm is gone. Deliberately not VmRSS or
/proc/<pid>/status: this file's own invariant forbids both in code because spec
section 7.3 forbids the RSS fallback, and this check needs neither -- it reads no
memory value, only whether an address space still exists. It must READ cmdline
rather than stat it, since every procfs file reports st_size 0 and `[ -s ]` would
call every healthy VMM mm-less.
Ambiguity still refuses. An absent or unreadable cmdline is proof of nothing and
returns 1, so the caller keeps refusing: treating "cannot tell" as 0 is how Sigma
PSS would silently vanish on a misconfigured SH_E11_PROC_ROOT, which is the
optimistic-direction failure spec section 7.3's boxed warning is about.
Tests: cases D-F on the existing fake-PROC_ROOT seam cover alive-but-mm-gone
(contributes 0), alive-and-holding-memory (still refuses, guard intact), and
absent cmdline (still refuses). Verified red first with a stub that never proves a
torn-down mm: only case D failed, so the new cases discriminate the fix from a
no-op. The VmRSS/status invariants at the end of the suite still pass.
463 assertions, 0 failures; shellcheck clean at the repo's gate (-x -S warning).
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
…1.82x Answers issue rossoctl#259's falsifiable question on bare metal (srv-r16b14s16, metal substrate, 2026-09-21). The ceiling is a property of the WORKER PROCESS, not the host, so the decision rule's first row fires: scale out. control, 1 worker c=8 67.76 Exec/s host 3.996 of 72 cores treatment, 2 workers c=8 123.57 Exec/s host 7.57 of 72 cores (10.5%) T2 / T1 = 1.824 (rule: >= 1.8 x T1 = 121.96) A second, independently instrumented pair gave 1.92 (128.99 vs 67.03), and the control reproduced to within 1% across both pairs. Reported as measured rather than rounded to "it scales": 1.824 is only 1.3% above the rule's boundary, and per-worker throughput fell 67.76 -> ~61.8 (-8.8%) when sharing the host, so a small shared component exists. At T2 the host was still ~90% idle, so N should be found by extending this experiment, not by assuming linearity. The per-session execGate cap of ~20 Exec/s per user is unchanged, and the isolated-snapshot variant was correctly not run: it is gated on the shared run showing no scaling, and the shared run scaled. Overlap of the two ~8-10s c=8 windows is proven rather than assumed. hostCpuFraction, coresBusy and processCount are host-wide (host_cpu_fraction diffs /proc/stat's aggregate cpu line), so both workers recording identical DOUBLED values can only happen if they ran concurrently: processCount 24 against the control's 12, hostCpuFraction 0.105 against 0.0555, with an independent 3s /proc/stat sampler agreeing (peak 3.26 -> 6.22 cores). Corollary recorded in the note: coresBusy must not be summed across workers, and standbysResident is misleading with two. Three instrument findings, all worth acting on separately: - PR rossoctl#299 is incomplete. pid_mm_is_gone excuses only a readable-AND-empty /proc/<pid>/cmdline; a VMM whose smaps_rollup read fails transiently during teardown while its cmdline still reads therefore still trips the refusal. Seen 3x across 2 runs with no added sampler load. Both times the die fired inside a command substitution and was swallowed, surviving only as pssRefusedTicks. - SH_PARENT_CGROUP is a FIFTH separation the runbook's four omit. Both workers sweep it at startup (one logged "swept 692 VM cgroup(s)"); safe here only because they start simultaneously. A worker starting while another runs would sweep the live worker's VM cgroups — which directly affects the scale-out recommendation this experiment makes. - Trap 6 reconfirmed: pssBytes 0 with pssRefusedTicks 0 and exit 0, twice. Run tree was main 45dbeae + PR rossoctl#299 (still open), a fast-forward to 023571b. deploy/microvm/predictions.json and EXPERIMENTS.md deliberately untouched; microvm-predictions passes 3/3. EXPERIMENTS.md numbers are a separate pass, as issue rossoctl#291's re-run did. Refs rossoctl#259 Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
mrsabath
left a comment
There was a problem hiding this comment.
Tight, well-scoped fix. The diagnosis is correct and the implementation fails in the safe direction. I verified the substance independently rather than taking the description's word for it.
The core claim holds. A task in do_exit()/exit_mmap() keeps its task_struct until it is reaped, so kill -0 succeeds after the mm is already gone — kill -0 genuinely cannot distinguish "alive holding memory" from "dying with none". Routing that into the "live but unreadable" refusal was wrong, and pss_bytes_for_pids' own exit-race comment already prescribed 0 for the case.
pid_mm_is_gone's truth table is exactly as documented. I ran it against a synthetic PROC_ROOT across all four states: empty cmdline → 0 (contribute 0); non-empty → refuse; absent → refuse; present but with the readable bit cleared → refuse. It returns 0 only on readable-and-empty and fails safe in every ambiguous case, which is the direction that matters here — the optimistic failure is the one that silently zeroes Σ PSS.
Both refusal sites are guarded. kill -0 appears at exactly two places in the script (e11-density.sh:639 and :661) and both received the same && ! pid_mm_is_gone treatment. No site left behind.
The invariant argument is sound. cmdline reads no memory value, so it needs neither VmRSS nor /proc/<pid>/status, and both prohibition assertions still pass. The [ -s ] warning in the comment is a real trap worth having written down: every procfs file reports st_size 0, so stat'ing instead of reading would call every healthy VMM mm-less and zero Σ PSS in precisely the direction spec §7.3's boxed warning is about.
I reproduced the red-first claim. Stubbing pid_mm_is_gone to return 1 — a no-op that never proves a torn-down mm — fails only case D, while E and F stay green. The new cases discriminate the fix from a no-op rather than passing either way, which is what makes them worth having.
On the test counts. I get 9 failures locally rather than the stated 0, but the failure set is byte-identical on origin/main (I diffed the two sorted sets), and all 9 are macOS environmental: no Linux /proc, pgrep -f differences, one Python traceback. None of them involve cases D–F, all six of which pass. The stated "463/0 locally, 461/0 on metal" is consistent with a Linux host, so I am not treating my macOS deltas as a finding.
Also confirmed: deploy/microvm/predictions.json is untouched, the scope is exactly the two files claimed, the commit is signed off, and all 13 checks pass including this repo's shellcheck gate.
The two further defects in the Notes — the in-rung sampler's missing zero-PSS refusal, and SH_E11_VMM_PROC_PATTERN being unscopable because the jailer chroots — are correctly left out. Each is a separate behavioral change, and folding either into this would have made it much harder to review.
Areas reviewed: Shell (bash), shell tests
Commits: 1, all signed-off: yes
CI status: passing (13 checks)
Review follow-ups on rossoctl#310. - The reads-after-r refusal offered "an SH_E11_PROC_ROOT that is not this host's /proc" as a likely cause, but a wrong root makes the proc entry ABSENT, so `[ ! -r "$smaps" ]` is true and the FIRST refusal fires instead -- confirmed by execution against an empty PROC_ROOT and a live pid. A reader who got the second refusal therefore had a correctly configured root and a second thing to go rule out, which is a milder form of the misdirection this PR removes. The hint moves to the first refusal, which until now offered no diagnosis at all; the second names the root only to rule it out. New Case K pins both halves, and both fail against the previous head. - Case H's source-shape pattern is anchored to the cmdline read itself (`<"$cmdline"; } 2>/dev/null`) rather than a bare `} 2>/dev/null`. $pss_body holds BOTH functions, so any future group redirect anywhere in pss_bytes_for_pids would have turned it green whatever the read did -- the exposure Case J already guards against by matching on the die line. Proven by mutation: with rossoctl#299's bug restored and an unrelated group redirect added, the old pattern reports ok and the anchored one fails. - Drop the dead `$fake_proc/$dead_pid/cmdline` rmdir operand: nothing ever creates that directory, and naming it implies Case G staged one. Drop a stray second blank line at the Case E/F boundary. bash deploy/microvm/tests/e11-density.test.sh: 473 ok, 0 FAIL, exit 0 make lint: exit 0 Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
…the re-run The 2026-09-17 caveat asked a falsifiable question: does E11's c=8 knee stay there once driver cost is removed and host CPU is sampled under load. It does. So the caveat's items are resolved rather than retracted, and this section's conclusion was right while only its evidence was wrong. Purely additive: no published number is removed. This section's own policy is that "the numbers stay ... the record of what the broken instrument produced", and the re-run is defined by comparison against them. Adds `### Issue #291 -- the re-run`, on the same bare-metal host and golden snapshot as the existing E10/E11 tables, with PR #293's repaired sampling and PR #296's Go Exec client: - knee = 8 on BOTH real arms, by the same p95-doubling criterion this section used for its published knee. The microVM knee is sharper than published: throughput now peaks at c=8 and declines, where the published ladder peaked at c=16. The container knee was reproduced twice, at ITERS_PER_SLOT 80 and 2000. - It is not the driver's knee. driver-control's own knee is 4 (Go) or 32 (grpcurl), never 8, and the Go driver is under 0.4% of the microVM arm's p95 at every rung -- against up to 23.7% had it been grpcurl, which quantifies the confound the 2026-09-18 note suspected. - bound = replenishment on the microVM arm is a GENUINE crossing, at the same c as the knee. A D sweep (2/4/8) then shows the knee does not move while standbys go 52 -> 439 and Sigma PSS 0.324 -> 1.443 GB, so the bound is the serialized 200ms replenishment RATE, not pool capacity -- standby-depth sizing is not the lever. - "No CPU or memory ceiling was reached" becomes a real finding instead of a restatement of the sampling bug: the true under-load means are 0.067 and 0.093 against crosses('cpu')'s 0.9, from 20-284 ticks per rung. - Sealed prediction 3 scores `supported` from a threshold derived from the same client that produced the ladder (94ms = go-client microVM c=1 p95 82.0 + E10 rung 3 restore 23.06/2), not from the grpcurl era's 124-133ms. - Issue #295 stays open and is recorded as such; it confounded nothing here. Also records two corrections to this section as published, rather than leaving them to be rediscovered: - The container arm's `bound: "cpu"` is attributeBound's documented fallback, not a crossing. Peak hostCpuFraction is 0.093 against a 0.9 threshold. It means "nothing bound", not CPU. - The driver-control table in the 2026-09-18 note does not reproduce past c=1. Same host, client and settings now give 1910.8 Exec/s at p95 39.26ms at c=64 where that note recorded 231.6 at 753ms on the same ~64 busy cores; c=1 agrees closely. Logged as an open discrepancy, explicitly not as a diagnosis. And the three instrument defects the run found: the dying-VMM PSS refusal that aborted the ladder (fixed in PR #299), that SH_E11_VMM_PROC_PATTERN cannot usefully be scoped and must be left unset, and that the in-rung sampler has no zero-PSS refusal (unfixed, same shape as #291's own item 1). predictions.json is untouched and its hash pin still passes. Every table figure was cross-checked against the committed rung records. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
Issue #259 asks a binary question -- is the ~62 Exec/s aggregate ceiling a property of the worker PROCESS or of the HOST -- and the two answers point at completely different follow-up work, so the experiment is worth setting up precisely. This is the operator document for it, in the same shape as docs/notes/e11-go-exec-client-comparison-runbook.md. Written after the issue #291 re-run, which changed the numbers #259 was drafted against and turned up three instrument defects that will abort this experiment if they are not accounted for. What the runbook fixes relative to the issue as drafted: - Corrected baselines. #259 says "39.04/s -> expect ~78/s"; those are pre-#291. The current single-worker c=8 figure is 80.62 Exec/s, so the two-worker target is ~161. - Three prerequisites, each load-bearing: PR #299 in the tree (without it the dying-VMM PSS refusal is fatal in the idle-standby poll and killed a run at c=4), the Go Exec client (grpcurl was up to 23.7% of microVM p95 at low c), and SH_E11_COLD_LATENCY_MS=94 derived from the Go client's own warm floor. - A decision rule fixed in advance, with three rows rather than two, so the partial-scaling outcome cannot be rounded into either story. - SH_MAX_COMMITTED_MB is per worker PROCESS: two workers at 409600 can commit 800 GiB against 754 GiB of RAM, and a budget above installed memory means every density number becomes a measurement of the OOM killer. It also records a per-session ceiling that #259 does not mention and that is NOT what the experiment tests: runPool.execGate is a one-slot channel per run pool, held from acquire until destroy whenever the launcher reports SerializesExecsPerRun() -- true for Firecracker, because the workspace ext4 image is not a shared-disk filesystem (spec section 4.3). So one session runs one Exec at a time and cannot exceed ~21 Exec/s, which is what the measured 17.56 at c=1 is. It does not serialize across users (different workspace_keys, different gates), but it is a hard capacity-planning fact. Traps section carries the seven failure modes observed on this rig, including that SH_E11_VMM_PROC_PATTERN must be left unset, that arm order is randomized every run, that the sampler slows as standbys multiply, and that a microVM rung can still record pssBytes: 0 with pssRefusedTicks: 0 and exit 0. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
…ossoctl#302) rossoctl#299 excuses a dying VMM only when /proc/<pid>/cmdline is READABLE AND EMPTY. But the caller's guard is `kill -0 && ! pid_mm_is_gone`, so the pid was alive a moment ago and can be reaped inside that window -- and then the redirection fails with ENOENT, which rossoctl#299 classified as "ambiguous" and still refused. Observed 4 times across 4 runs on srv-r16b14s16, and inside host_signals_snapshot's idle-standby poll that refusal is fatal, so it aborted the ladder. The discriminator is a RE-TEST of `kill -0`, deliberately not "the proc entry is absent": Case F of the test file pins that a LIVE pid with an absent cmdline must keep refusing, because that is indistinguishable from a misconfigured SH_E11_PROC_ROOT -- the optimistic-direction failure spec section 7.3 forbids. "Absent AND the task is now gone" is the only safe reading. EPERM/EIO on a live, memory-holding process still refuses, and Case I now pins that the hole stays shut. The `[ -r ]` pre-test is dropped rather than patched. It bought nothing -- the read is the real test, and the file must be READ rather than stat'ed anyway, since every procfs file reports st_size 0 -- while adding a second, differently-handled failure path for the same condition. The stderr redirect now wraps the whole group. `tr ... 2>/dev/null` does not cover this: the failure is in the REDIRECTION, which bash reports itself before tr is executed, which is where the bare "line NNN: ...: No such file or directory" in the run logs came from. Also rewords the reads-after-r refusal. It used to end "Most likely the pid is not ours: check SH_E11_VMM_PROC_PATTERN". In every observed occurrence that variable was unset at its correct default and the box was idle, and it is meant to STAY unset: the jailer chroots so its install path matches nothing, and any value passed is matched inside sudo's own argv by the unscoped pgrep -f. So the message named the one thing that was not the cause and pushed the reader toward making it worse. It now names ptrace gating and a wrong SH_E11_PROC_ROOT, and says explicitly that the pattern variable should be left unset. Two of the four new checks assert on the source text rather than by execution, and say so: both triggers are TOCTOU races that cannot be staged deterministically, and the portable stand-ins do not reproduce them -- on macOS open() on a directory succeeds and awk just reads nothing, so such a test passes with or without the fix. Source-shape assertions are this file's existing idiom for that situation. 470 checks pass (466 before); shellcheck and prettier clean. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
Summary
pss_bytes_for_pidsrefused on a pid thatkill -0reports alive but whose address space isalready gone, which aborted E11 microvm ladders mid-run on bare metal. A task inside
do_exit()/exit_mmap()keeps itstask_structuntil it is reaped, sokill -0succeeds,while
smaps_rolluppasses-rand then fails to read. That routed a dying Firecracker VMMinto the "live but unreadable" refusal the function reserves for a live, memory-holding
process — and in
host_signals_snapshot's idle-standby-residency poll, where a failed snapshotis fatal, it killed the whole ladder.
The function's own exit-race comment already prescribes 0 for this case ("a pid that has already
exited between discovery and sampling contributes 0").
kill -0simply cannot distinguish"alive holding memory" from "dying with none".
Found while running the issue #291 re-run on
srv-r16b14s16(72 cpu / 754 GiB,virt: none).Evidence
Measured on that box, 2026-09-20:
In-window sampler ticks only mark
pssRefusedTicks(non-fatal); the fatal path is theidle-standby poll, so whether a given run dies is timing luck.
Dstate with an emptycmdline, not the jailer, not theworker, and not another user's process.
smaps_rollupread succeeded had a non-emptycmdline; 171/171 whose read failed had an empty one.With this patch the same ladder completes all 7 microvm rungs with
pssRefusedTicks0 atc=1–16 and 4/6 at c=32/64 (the remaining ones are the ambiguous cases, still refusing by design),
and Σ PSS grows monotonically 0.001 → 0.323 GB.
Why
cmdlineand notVmRSSThree parts of the choice are load-bearing:
VmRSSor/proc/<pid>/status. This suite asserts neither string appears in code,because spec §7.3 forbids the RSS fallback. The
cmdlinecheck reads no memory value at all,only whether an address space still exists, so it needs neither file. Both invariant assertions
still pass.
cmdlinemust be READ, not stat'ed. Every procfs file reportsst_size 0, so[ -s ]here would call every healthy VMM mm-less and silently zero Σ PSS — the same
optimistic-direction failure this guard exists to prevent.
cmdlineis proof of nothing and returns1, so the caller keeps refusing. Treating "cannot tell" as 0 is how Σ PSS would vanish on a
misconfigured
SH_E11_PROC_ROOT.Tests
Cases D–F on the existing fake-
PROC_ROOTseam:cmdline) → contributes 0, not a refusal.cmdline) → still refuses, guard intact.cmdline→ still refuses, not silently 0.Verified red first with a stub that never proves a torn-down mm: only case D failed, so the
new cases discriminate the fix from a no-op rather than passing either way.
463 assertions / 0 failures locally; 461 / 0 on the metal box against real
/procand realkill -0. Shellcheck clean at this repo's own gate (-x -S warning).Notes
kill -0happened to lose the race; this only stops the same event being fatal when it wins.deploy/microvm/predictions.jsonis untouched.change: the in-rung sampler has no zero-PSS refusal (
require_vmmreaches only the post-loadsnapshot, so a microvm rung can record
pssBytes: 0withpssRefusedTicks: 0and exit 0), andSH_E11_VMM_PROC_PATTERNcannot usefully be scoped — the jailer chroots, so the VMM's argv is/firecracker --id vm-Nand the absolute install path matches nothing, while passing any valueputs it in
sudo's argv wherediscover_pids'pgrep -fmatches it.🤖 Generated with Claude Code