Repository navigation
Description
Found while running issue #259's worker-parallelism experiment on srv-r16b14s16
(bare metal, SH_SUBSTRATE=metal, 2026-09-21). The run tree was main 45dbeae
fast-forwarded to PR #299's head 023571b, so #299's fix was present and this
still fired.
What #299 fixed, and the case it leaves open
#299 added pid_mm_is_gone so a dying VMM contributes 0 to Σ PSS instead of refusing:
pid_mm_is_gone() {
local cmdline="$PROC_ROOT/$1/cmdline" content
[ -r "$cmdline" ] || return 1 # <-- unreadable: ambiguous, so still refuse
content="$(tr -d '\0' <"$cmdline" 2>/dev/null)" || return 1
[ -n "$content" ] && return 1
return 0
}It returns "the mm is gone" only when /proc/<pid>/cmdline is readable and reads
empty. That is deliberate and the reasoning is sound — treating "cannot tell" as 0 would
let Σ PSS silently vanish on a misconfigured SH_E11_PROC_ROOT.
But it means a VMM whose smaps_rollup read fails transiently while its cmdline still
reads non-empty is classified as a live, memory-holding process and still trips:
e11: smaps_rollup for pid 4124224 (/proc/4124224/smaps_rollup) passed a readability test
and then FAILED to read while the process is still alive - refusing to let it contribute
0 bytes to Sigma PSS (spec section 7.3's boxed warning). Most likely the pid is not ours:
check SH_E11_VMM_PROC_PATTERN ...
The message's own hypothesis (SH_E11_VMM_PROC_PATTERN picked up a foreign process) was
not the cause here: SH_E11_VMM_PROC_PATTERN was left unset at its correct default,
and the box was otherwise idle (the only other user held a shell at a flat 0.30% of one
core for the whole window).
Observed
| run | arm | pssRefusedTicks |
notes |
|---|---|---|---|
| control2 (1 worker, c=8) | microvm | 1 | heavy auxiliary /proc sampler running |
| control3 (1 worker, c=8) | microvm | 2 | no auxiliary sampler |
| treat3 w1 (2 workers, c=8) | microvm | 2 | no auxiliary sampler |
3 occurrences across 2 runs with no added load, so it is inherent to the teardown path at
this Exec rate, not induced by extra /proc traffic. My first hypothesis was that my own
sampler widened the race; that was wrong — it recurred without it.
Why it did not abort, and why that is not reassuring
In all three cases the die was swallowed: it fired inside a command substitution,
which discards the exit status along with the refusal. The ladder continued and the tick
was correctly recorded as pssRefusedTicks, which is the desired behaviour for an
in-window sampler tick.
That is luck, not design. e11-density.sh warns about exactly this shape in its own
comments, and the pre-#299 report (issue #291's re-run) had the same refusal reach
host_signals_snapshot's idle-standby-residency poll, where it is fatal and aborted a
three-arm ladder at c=4. The unsafe path still exists; only the cmdline-empty subset of
inputs is now excused from it.
Suggested direction
Not proposing a patch, since the tradeoff is a judgement call about what evidence is
sufficient to call an address space gone. Two options:
- Distinguish transient from persistent. Re-read
smaps_rolluponce after a short
delay before refusing. A torn-down mm stays unreadable; a transient failure resolves or
the pid disappears. Costs a retry per refusal, only on the failure path. - Treat "alive, cmdline readable, smaps_rollup unreadable" as its own recorded
category rather than folding it into either the refusal or a silent 0 — a
pssTransientUnreadableTicksalongsidepssRefusedTicks, so Σ PSS is disclosed as
incomplete without the run dying.
Either way the fatal call site in host_signals_snapshot's poll deserves the same
treatment as the in-window sampler, since a refusal there costs the whole ladder.
Unrelated, same run: pssBytes: 0 with pssRefusedTicks: 0
Reconfirming the known gap (documented as trap 6 in #259's runbook): two microVM rungs
recorded pssBytes: 0 with pssRefusedTicks: 0 and exit 0 —
.results-control3-w1 c=1 and .results-smoke-w2 c=1. require_vmm is passed only by
the post-load snapshot call sites, not by the in-rung sampler, so a zero Σ PSS is not a
refusal there. Mentioned here because both defects live in the same sampling path; happy
to split it out if preferred.
Activity
pdettori commentedon Sep 21, 2026
Follow-up with a concrete root cause, found while running further diagnostics on the same
box. The refusal fires on a pid that has fully exited, not on a live memory-holding one.
The driver's own log caught the failing read, which the original report did not have:
Line 628 is the read inside
pid_mm_is_gone:Sequence
smaps_rollupread fails (VMM tearing down).kill -0 "$pid"succeeds — the task is still present (dying, or a zombie not yet reaped).pid_mm_is_goneruns:[ -r "$cmdline" ]passes./proc/<pid>/disappears.<"$cmdline"fails with ENOENT, sotrnever runs and thefunction returns 1 = "ambiguous".
die.So the pid the refusal describes as "still alive" is in fact gone — the one case the
function exists to excuse.
Two incidental details worth fixing alongside
2>/dev/nullis attached totr, but the failure isin the redirection, which bash reports before
tris executed. Hence the bareline 628: ... No such file or directoryabove. A reader sees a script error with noindication it is an expected race.
SH_E11_VMM_PROC_PATTERNpicking up a foreign process. In these runs that variable wasunset at its correct default and the box was otherwise idle (the only other user sat at a
flat 0.30% of one core). The suggested check sends the reader somewhere the fault is not.
Suggested direction
An absent
/proc/<pid>/cmdlineis not ambiguous — combined with the pid having been reaped itis proof the address space is gone. Distinguishing ENOENT (process gone -> contribute 0)
from other read failures (EPERM, EIO -> still refuse) preserves the guard's intent while
closing this case. Equivalently, re-test
kill -0after the failed read and treat"now gone" as the exit race the surrounding code already excuses.
Observed 4 times across 4 runs on
srv-r16b14s16at c=8 withSH_E11_EXEC_CLIENT=go, so itreproduces readily at this VM churn rate.
Merge pull request #310 from pdettori/fix/302-pid-mm-gone-enoent
fix(relay): a failed Exec must not return a gRPC OK status (#295)
fix(e11): a pid reaped mid-sample is gone, not an ambiguous refusal (r…