Expand description
Memory-pressure-aware host supervision — P0 of
docs/specs/SPEC_MEMORY_PRESSURE_SUPERVISION_2026_06_16.md.
The launcher’s host-relaunch ladder (HOST_RESTART_BUDGET) is otherwise
memory-blind: on a system out-of-memory host crash it relaunches straight
back into the same commit-starved condition, burns the budget in seconds, and
gives up — a silent vanish (see docs/retro/retro-oom-crash-2026-06-16.md).
This module adds the discrimination: a system-OOM exit is waited out (commit- gated, backed-off relaunch on a separate, longer OOM budget), while a genuine host fault still trips the fast wedged-host budget + degraded ladder unchanged. The decision logic here is pure and unit-tested; the platform commit probe and the backoff wait are thin wrappers over the OS.
Enums§
- Host
Exit Class - Classification of an abnormal (non-zero, non-clean-shutdown) host exit.
Constants§
- BACKOFF_
CAP - BACKOFF_
START - Commit-gated relaunch backoff: while commit-free is below
RESUME_FLOOR_MB, wait this long and re-probe, doubling each time up to the cap. Relaunching into a starved system just re-OOMs, so waiting is the only thing that works. - CHROMIUM_
OOM_ EXIT_ CODE - Chromium’s intentional out-of-memory abort code (
base::win::kOomExceptionCode, raised non-continuably viaKERNELBASE!RaiseExceptionwhen an allocation fails). It surfaces as the host’s exit code;ExitStatus::code()returns it as ani32, so the unsigned0xE000_0008reads back as-536_870_904. - OOM_
GIVEUP_ BODY - OOM_
GIVEUP_ TITLE - User-facing copy for the graceful give-up dialog (SPEC §5.C). Shown via the
launcher’s
show_fatal_dialog(a renderer-free Win32MessageBoxW) so the crash is never a silent vanish. - OOM_
RELAUNCH_ DEADLINE - Hard ceiling on how long to wait for commit to recover before giving up (and showing the honest “out of memory” dialog rather than waiting forever).
- OOM_
RESTART_ BUDGET - Restart budget for system-OOM host exits — larger and longer than the
wedged-host
HOST_RESTART_BUDGET(3 / 60 s), because transient system pressure is the OS’s problem, not a host bug, and recovery can legitimately take minutes (SPEC §5.B / §6). - OOM_
RESTART_ WINDOW - RESUME_
FLOOR_ MB - Minimum commit-free (available page file) headroom, in MB, before it is safe
to (re)launch a CEF host without it instantly re-OOMing. A fresh host +
renderer commits on the order of a few hundred MB; 512 leaves margin. Shared
starting point with the renderer spec’s
RESUME_FLOOR(SPEC §6).
Functions§
- await_
commit_ recovery - Wait for system commit to recover above
RESUME_FLOOR_MB, probing with exponential backoff (BACKOFF_START→BACKOFF_CAP). Returnstrueonce recovered, orfalseifOOM_RELAUNCH_DEADLINEelapses first (the caller then gives up gracefully).logis the launcher’s logger, threaded in so the wait is observable in the launcher log.subjectnames whatever is being waited on for the two terminal log lines (“relaunching {subject}” / “giving up {subject} relaunch”) — this function is shared by the host-OOM wait (subject: "host") and the srv-OOM wait (subject: "srv",SPEC_MEMORY_PRESSURE_SUPERVISION’s srv counterpart). Hardcoding “host” here made the srv-OOM wait’s log misleadingly claim it was relaunching the host during an actual srv-OOM incident — reagent P1 on PR #2206. - budget_
exhausted - Crash-budget bookkeeping, factored out so it is unit-testable. Retains only
restarts within
windowofnow; if the surviving count is already atbudget, returnstrue(exhausted — caller gives up) WITHOUT recording. Otherwise recordsnowand returnsfalse. Matches the existing inline wedged-host budget semantics (check-before-push). - classify_
host_ exit - Classify an abnormal host exit. OOM is identified two ways, deliberately defensive — Chromium sometimes surfaces an OOM as a generic crash code rather than the exact OOM exception (electron#40426):
- commit_
free_ mb - Linux commit proxy:
MemAvailablefrom/proc/meminfo. The kernel OOM-killer (a SIGKILL) is the real OOM signal here; the abnormal-exit-plus-low-commit reading together approximate it (SPEC §9.4 open question). - next_
backoff - Next backoff duration: double
prev, capped atBACKOFF_CAP.