Repository navigation
docs(metal): record four measurement traps that each cost a wrong or empty result - #333
Conversation
…ctl#328) The instrument, before the fix it exists to measure. The `jailer` phase timed time.Since AFTER cmd.Start() returned -- fork/exec RETURNING, 0.34-1.62 ms across a whole ladder -- so the jailer's 6-8 ms of chroot construction was accounted to sockwait instead. That mis-attribution is why the pre-socket wait read as "Firecracker is slow to bind" for two rounds of analysis, and it would equally obscure whether jail pooling worked. sockwait now splits into jailersetup_us and fcbind_us, and the old jailer_us is renamed spawn_us to say what it actually measures. sockwait_us is kept unchanged so rossoctl#328's tables and the campaign notes stay comparable against new runs. The boundary is /proc/<pid>/comm flipping to the jailed binary's name. The jailer execve's rather than forking, so cmd.Process.Pid names the Firecracker process too -- which makes the flip the execve ITSELF rather than a proxy for it. Both filesystem proxies rossoctl#328 suggested were measured and rejected: firecracker.pid appears 0.20 ms early because the jailer writes it just before the execve, and the jail directory appears at 1.55 ms of a 5.23 ms window. On srv-r16b14s16, n=8 cold, this puts jailer_setup at 93% of the pre-socket window and fc_bind at 0.37 ms -- corroborating rossoctl#328's 82-85% strace split by a different method. Two properties the tests pin, because a diagnostic that distorts what it measures is worse than none: - The observation is gated on phaseLog, so no restore pays a procfs read when diagnostics are off, and it self-disables after the flip rather than reading comm for all ~27 poll iterations of a sockwait. - It reuses waitForUnixSocket's loop instead of adding a second one. rossoctl#304's schedule is the resolution at which anything inside that wait can be measured, so two schedules would make the two halves accurate to different quanta and their sum no longer sockwait. Nothing here can fail a restore: an unobservable boundary reports -1 -- never a plausible 0 -- and the restore proceeds on sockwait alone. Refs rossoctl#328 Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
…ossoctl#328) The investigation behind the phase split, kept so nobody re-runs it. The pool was designed, implemented and measured. It cuts restore latency by a reproducible ~1.6 ms -- three independent ways -- and loses ~9.24% throughput at the 64-slot operating point, because keeping the 3.6 MiB exec copy turns writes that base elides into real writeback: ~2.1x the disk writes and ~12% more host CPU. The saving and the cost are the same decision, since keeping that file was the entire saving. Also records four corrections to the premise in rossoctl#328's third comment, each measured with the previous VMM reaped and the socket deleted first: --id reuse fails outright unless root/dev/ is wiped (mknod EEXIST); the 2x figure was very likely timing that comment's own leftover socket; pre-creating the jail directory buys nothing, so the real baseline was not cold; and the jailer re-copies the binary every run regardless. The residue analysis is kept even though the code is not, because anyone retrying has to answer the same questions and two of the answers outlive the change: the jailer opens the exec path O_NOFOLLOW, so the symlink form of a root-write primitive is already refused, but a HARDLINK is not -- and the jail holds our own prep's hardlinks to the golden snapshot, so st_nlink == 1 is what stops a compromised VMM relinking that path onto memfile and having the next jailer run write Firecracker into the snapshot every VM restores from. The implementation is preserved on archive/328-jail-pool-regression rather than deleted, and this note says so, since the note's own instruction is not to re-investigate and the code is that evidence. rossoctl#328's option 2 gets stronger: bypassing the jailer removes the copy outright rather than relocating it, so it avoids both the allocation and the writeback. Refs rossoctl#328 Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
…empty result Salvaged from the rossoctl#331 handoff note, whose thesis rossoctl#332 refuted. These four are recorded in neither rossoctl#332's design note nor anywhere else on main, and they share a shape worth naming: the instrument reports something plausible, so a clean number is indistinguishable from a broken probe. - `RESULTS=` is the only name for a per-rung results dir. There is no SH_E11_RESULTS_DIR; an unrecognised name is silently ignored, every rung falls back to the default .results/, and the worker log is TRUNCATED per invocation. An eight-rung ladder can exit 0 everywhere and yield phase data for one rung. This cost a full ladder. - `sched_schedstats` is off on this host, so /proc/<pid>/sched carries no se.statistics.* fields. A probe reading wait_sum to detect CPU starvation measures nothing and reports nothing, which reads as "never starved". - Never time `sudo <thing>`: it is setuid doing PAM work and accounted for ~13 ms of a 16 ms reading. Also calibrate the harness, because each $(date +%s%N) is a fork+exec and puts the floor of a shell-timed measurement at ~2.4 ms — the same order as phases worth measuring. - A leftover socket reads as this run's socket coming up, because waitForUnixSocket dials. fcJailOccupied exists to refuse exactly this and its comment says so. The signature is repeated attempts agreeing far too closely: two runs within 17 us is a constant, not reproducibility. One measurement reported a 2x jail-reuse win on that basis; the real figure was -31%, and the change it motivated cost 9% throughput. Cross-references section 3a for the existing kill-by-cgroup-or-port guidance and adds that pgrep -f self-matches through its own ssh and sudo argv. Refs rossoctl#328 rossoctl#332 Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
rubambiza
left a comment
There was a problem hiding this comment.
Summary
Net change is docs-only and clean: a main...head comparison shows this PR is 1 commit ahead / 5 behind main, and the only file that differs from main is deploy/microvm/METAL-RUNBOOK.md (+60 lines). The jail_exec_boundary.go/_test.go feature code shown in the raw diff already exists on main byte-identical (blobs 9005a309/e5c32200), and the design note exists on main in a newer revision — so git's 3-way merge contributes only the runbook section and reverts nothing. The PR body's "Docs only. No code changes" is accurate for the merged result. New section 6a is well-placed (after §6, before §7), its §3a and design-note cross-references both resolve, and CI is green.
Heads-up (not blocking): the branch is based on a stale point, so the raw diff looks like it re-adds already-merged code. Consider a rebase onto current main so the PR diff matches the true net change — it makes the "docs only" claim self-evident to a reviewer reading the diff rather than the compare view.
Author: pdettori (MEMBER — maintainer)
Areas reviewed: Docs (Markdown), plus verification that the Go/diff content is already on main
Agent/IDE config (.claude/.vscode): none
Commits: 3 commits, all signed-off: yes; conventional prefixes: yes (3rd headline 79 chars, over the 72 advisory — nit)
CI status: passing (all 13 checks green, incl. DCO, lint, shellcheck, hadolint, trivy, codeql)
| @@ -389,6 +389,66 @@ rung 4 being the long pole of E10 outside rung 1. | |||
| **Do not edit `deploy/microvm/predictions.json`.** Falsified predictions get reported as | |||
| plainly as confirmed ones — that is the point of having pinned them. | |||
|
|
|||
There was a problem hiding this comment.
nit (non-blocking): the section is clear and both cross-references (§3a, the 328-jail-pool-design.md note) resolve on main. Optional tightening — the sudo trap's ~16 ms/~3 ms figures and the ~2.4 ms date +%s%N floor are host-specific to srv-r16b14s16 like the rest of the runbook; a one-word "(on this host)" would keep a reader on other hardware from reading them as universal constants.
Summary
Adds
## 6a. Four traps that have each cost real timeto METAL-RUNBOOK.md. Docs only.Salvaged from the #331 handoff note, whose central thesis #332 refuted — so #331 is being closed
rather than merged. These four are recorded in neither #332's design note nor anywhere else on
main, and they are the part of that note that outlived its recommendation.They share a shape worth naming, which is why they are grouped: the instrument reports something
plausible, so a clean-looking number is indistinguishable from a broken probe.
RESULTS=is the only name for a per-rung results dirsched_schedstatsis off, so/proc/<pid>/schedhas nowait_sumsudoinside a timing clocksudoitselfwaitForUnixSocket, which dialsDetail on the two that were most expensive
RESULTS=— there is noSH_E11_RESULTS_DIR. An unrecognised name is silently ignored, everyrung then writes to the default
.results/, and two consequences follow that are easy to miss: arung record is overwritten by any later rung with the same
c, and the worker log is truncated perinvocation, so only the last rung's
SH_DIAG_PHASESlines survive. This cost a full ladder.The leftover socket — this one is in the codebase already:
fcJailOccupiedexists to refuse itand its comment spells it out. The addition here is the signature, so it can be spotted in the
output rather than in the code: repeated attempts agreeing far too closely. Two runs within 17 µs of
each other is a constant, not reproducibility. That is how the jail-reuse "2x" in #328 happened, and
the note points at
docs/notes/2026-09-22-328-jail-pool-design.mdfor where it led.The harness-calibration point is worth reading alongside it: each
$(date +%s%N)is itself afork+exec, which puts the floor of any shell-timed measurement on this host at ~2.4 ms — the same
order as several phases worth measuring. Time
/bin/truethe same way and subtract, or usestrace -ttfor anything finer.Placement
New section 6a, immediately after "What to capture and hand back" and before "Reading the verdict" —
i.e. with the other things you need while a run is in flight rather than in an appendix. It
cross-references the existing section 3a for kill-by-cgroup-or-port, and adds that
pgrep -fself-matches through its own ssh and sudo argv.
Testing
make fmtandmake lintpass. No code changes.Related
Supersedes the salvageable half of #331 (being closed). #332 carries the
--no-api/--config-filedead end, so that is not duplicated here.