Skip to content

e11: #299 still refuses on a VMM whose smaps_rollup read fails while its cmdline reads #302

Closed

Description

@pdettori

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:

  1. Distinguish transient from persistent. Re-read smaps_rollup once 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.
  2. 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
    pssTransientUnreadableTicks alongside pssRefusedTicks, 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.

Refs #299, #259, #291

Activity

  1. pdettori commented on Sep 21, 2026

    @pdettori
    MemberAuthor

    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:

    deploy/microvm/e11-density.sh: line 628: /proc/189256/cmdline: No such file or directory
    e11: smaps_rollup for pid 189256 (/proc/189256/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 ...
    

    Line 628 is the read inside pid_mm_is_gone:

    pid_mm_is_gone() {
      local cmdline="$PROC_ROOT/$1/cmdline" content
      [ -r "$cmdline" ] || return 1
      content="$(tr -d '\0' <"$cmdline" 2>/dev/null)" || return 1   # <-- line 628, ENOENT here
      [ -n "$content" ] && return 1
      return 0
    }

    Sequence

    1. smaps_rollup read fails (VMM tearing down).
    2. kill -0 "$pid" succeeds — the task is still present (dying, or a zombie not yet reaped).
    3. pid_mm_is_gone runs: [ -r "$cmdline" ] passes.
    4. Between that test and the read, the pid is reaped and /proc/<pid>/ disappears.
    5. The bash redirection <"$cmdline" fails with ENOENT, so tr never runs and the
      function returns 1 = "ambiguous".
    6. The caller treats ambiguous as "live and memory-holding" and calls 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

    • The error text leaks to the log. 2>/dev/null is attached to tr, but the failure is
      in the redirection, which bash reports before tr is executed. Hence the bare
      line 628: ... No such file or directory above. A reader sees a script error with no
      indication it is an expected race.
    • The refusal message misattributes the cause. It points at
      SH_E11_VMM_PROC_PATTERN picking up a foreign process. In these runs that variable was
      unset 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>/cmdline is not ambiguous — combined with the pid having been reaped it
    is 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 -0 after the failed read and treat
    "now gone" as the exit race the surrounding code already excuses.

    Observed 4 times across 4 runs on srv-r16b14s16 at c=8 with SH_E11_EXEC_CLIENT=go, so it
    reproduces readily at this VM churn rate.

  2. added a commit that references this issue on Sep 21, 2026
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