Skip to content

node health: remember the fabric manager per boot, so one that stays down is lost - #905

Open
michaellchung wants to merge 7 commits into
mainfrom
own/health-fm-sticky
Open

michaellchung wants to merge 7 commits into
mainfrom
own/health-fm-sticky

Conversation

@michaellchung

@michaellchung michaellchung commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The cuda node health checker gave a fabric manager reason only on the one check where
systemctl is-active nvidia-fabricmanager went from active to inactive/failed.
The next check saw failed in prev and judged the node ok again, so a node whose fabric
manager stayed down went ok -> bad_once -> ok -> ok and never reached the two bad checks
in a row that make it lost (and get it replaced). While the NVLink fabric state still
reads Completed, nothing else catches it.

Change (yeto/hw/node_health.py)

  • The fabricmanager section (FM_SCRIPT) prints first the state (the section's exit
    code is still systemctl's), the unit's LoadState and ActiveEnterTimestampMonotonic
    (systemctl show -p, prefix cut: --value needs systemd 230), and whether the node's
    processes are visible (/proc/1/comm readable, and not in a container: the output of
    systemd-detect-virt -c, where none is not one; without the tool a non-empty
    /run/systemd/container, /.dockerenv, /run/.containerenv or container= in pid 1's
    environment). Whenever the state is not active it counts the nv-fabricmanager
    processes (/proc/<pid>/comm, cut at 15 characters) with their pid and start time.
    Then the unit's NRestarts and what shows NVSwitch on the node: entries in
    /proc/driver/nvidia-nvswitch/devices, device files /dev/nvidia-nvswitch<N>, NVIDIA
    class 0680 devices when lspci runs (no count when it fails), split into NVSwitch ids
    (10de:1af1 A100 HGX, 10de:22a3 H100 / H200 HGX, from pci.ids) and other NVIDIA
    bridges, and every Mellanox (15b3) PCI function with how many of their VPD read (1 s
    each, 3 s in all; none without timeout) and how many name the NVLink switch management
    port (SW_MNG).
  • read_fabric_manager(section) -> (state, NRestarts, probe), the process first: a state
    that is not active while an nv-fabricmanager process runs reads active (a GPU
    Operator driver container runs it, maybe next to a stale host unit that is disabled,
    inactive or failed). Else no unit (not-found), or inactive / failed of a unit
    that is not loaded (masked), with no process reads not running; of a loaded unit
    it stays (it stopped). Hidden processes (hidepid, a container) leave an inactive /
    failed state unread, with one node_health_degraded note per node, since a driver
    container's fabric manager would not show; a loaded unit that was active in this boot
    (ActiveEnterTimestampMonotonic > 0) and is failed stays failed. A section cut off
    after the state line says FM section timed out after reading state.
  • nvswitch_of(probe, gpu_names, fabric) -> (yes | no | unread, basis). On HGX B200 /
    B300 the NVSwitches are not PCIe devices of the host (they sit behind a ConnectX
    bridge reached through NVLSM, per the NVIDIA Fabric Manager User Guide; amazon-eks-ami
    PR 2840 shows no procfs entry and no class 0680 bridge on p6-b200), so a missing device
    is never read as "no NVSwitch". In order: a GB GPU -> no (NVL72-class compute tray,
    whatever else it shows; its fabric state judges the topology); NVSwitch devices or an
    NVSwitch PCI id -> yes (A100 / Hopper HGX); no real fabric state -> no (PCIe); a VPD with
    SW_MNG on any function -> yes; every GPU a B200 / B300 (not GB, not PCIe) with a real
    fabric state -> yes (the rule without root, since the VPD reads as root only; a VPD
    without the port does not overrule it); another NVIDIA 0680 bridge -> yes (soft);
    every Mellanox VPD read without it -> no; anything else (or the fabric state unread) ->
    unread.
  • Per-boot memory: the checker keeps fm_boot, the boot id (from the XID section's
    boot= line) in which the fabric manager must be active. It is set when the fabric
    manager reads active, or at the first judged read on a node with NVSwitch; carried
    over read failures; dropped when the boot id changes. In that boot every check whose
    state is not active (inactive, failed, activating, deactivating) is bad until
    it reads active again. A systemctl that timed out (no state) judges nothing.
  • First read of a new launcher (the memory is in HealthWatch.prev, in memory only):
    on a node with NVSwitch any state but active (including inactive) is bad at once
    and that boot is remembered, so two such checks make the node lost. A read where the
    state did not read or NVSwitch was not determined judges nothing and does not count as
    the first judged read (fm_judged, carried).
  • A node with no NVSwitch of its own (PCIe, a GB compute tray whose unit may be installed
    and failed, a VPD without the switch port) is never judged on its fabric manager,
    even after it was active in the boot. A fabric that is not Completed still makes the
    node bad by its own reason. A node whose NVSwitch is not determined is judged only on
    the per-boot memory (a fabric manager that ran has a fabric to manage).
  • Restarts, on a node that must run the fabric manager: NRestarts that grew since the
    previous check of the same boot, or, for a fabric manager without its unit, every
    process (pid and start time) of the previous check gone (one more process that comes
    and goes is no restart). Each check that saw one writes a new node_health_fm_restarted
    event (streak, NRestarts or the process ids; from the island launcher, the node
    runtime log, and the pool from the health record, once per check). A restart is a
    reason only at the 3rd check in a row (FM_RESTART_STREAK), so a loop that goes on
    makes the node lost at about the 4th check (~4 min, on purpose: one or two restarts
    that come back lose no node). A check without a restart zeroes the streak; a read
    failure keeps it (carried). NRestarts counts only systemd's own restarts, so it needs
    Restart= on the unit.
  • fabric_manager_absolute(facts) -> (verdict, detail) with FM_OK / FM_BAD /
    FM_UNREAD: the rule on one check alone, from that check's own facts (nvswitch,
    fm_state, nvswitch_hard, fabric_complete, never carried), for callers that judge
    a node without an earlier check. A fabric manager that is not running is bad when the
    node shows hard evidence of NVSwitch (a device, an NVSwitch PCI id, the VPD port; the
    GPU names and other NVIDIA bridges are not), ok when it does not and every GPU's fabric
    is Completed/Success (managed off-host: a shared NVSwitch guest VM, or a guest whose
    NVSwitch cannot be determined), else unread. A loaded unit inactive / failed with no
    process, on a node with soft evidence only and a Completed fabric, goes by
    ActiveEnterTimestampMonotonic: 0 (never active in this boot) ok, > 0 bad, unread
    unread. NVSwitch not determined is otherwise FM_UNREAD, never FM_OK. The checker
    uses it for the first judged read.
  • A new boot forgets everything: a fabric manager never active since the reboot is
    judged exactly as before (one bad check when it was active before the reboot, on a
    node with NVSwitch; then the fabric state judges the node). Checked against the old
    code on the same sequences.
  • Backward compatible prev: a prev without fm_boot whose fabric manager was active
    is taken as active in the boot of its XID cursor (else the current boot); a prev
    without fm_judged counts as judged when it has fm.
  • Without a boot id, a stop is bad once (as before).
  • HealthTracker (two bad checks in a row -> lost) and the existing events are
    unchanged.

docs/NODE_RUNTIME.md: the health table row and a section on the fabric manager rule,
with the NVSwitch and state tables, their public sources, what is not yet seen on our own
hardware (the VPD keyword on an HGX B300 node, GB300 tray GPU names), and a known limit: on
HGX B300 bare metal checked without root there is no hard evidence of NVSwitch, so a fabric
manager without a loaded unit that dies after the fabric reads Completed, never seen by
the check, reads as off-host; new CUDA launches then fail with cudaErrorSystemNotReady
and the trainer reports it.

Tests

tests/test_node_health.py (fixtures follow an HGX B300 node as a non-root user sees
it: no NVSwitch device on the host, ten ConnectX devices, VPD unread, a Completed fabric):
three failed checks after active -> ok, bad_once, lost, lost with one node_health
event; every non-active state sticks; active clears the streak; read failures keep the
memory; PCIe / N/A / GB tray / VPD-without-switch nodes never report, even after active
in the boot; the NVSwitch table case by case; a new boot behaves as before; a new
launcher on B300 (with and without root) and Hopper reports every non-active state at
once and reaches lost; first reads that cannot judge are not counted (fabric timed
out, then three failed reads -> ok, bad_once, lost, lost); inactive at the first read
by NVSwitch and fabric; restart counting per boot; fabric_manager_absolute on one
check, including the B300 sample with the fabric unread -> unread; a unit that is not
there (Hopper, B300 by name, B300 as root with PF VPD readable): with no process
ok, ok, ok and unread, with a process active, a process seen then gone ->
bad_once, lost, a fabric not completed still bad; one NVSwitch device; a B-like name
(B40); the section script run under bash against fake systemctl (LoadState) / lspci /
timeout / procfs / process comm / device files / sysfs VPD (SW_MNG on a .1 function
only); the review scenarios (masked unit crashed / with its process, stale disabled or
failed host unit with a driver-container fabric manager, a failed unit with nothing
running on Hopper and on B300 as root, systemd < 230 without --value); B300 without
root by ActiveEnterTimestampMonotonic (never active -> ok, active before -> lost,
unread -> unread); only lspci 10de:22a3 with nothing running -> lost, only another
NVIDIA 0680 bridge -> ok / unread; off-host guests; hidepid and containers (detection by
systemd-detect-virt -c output and its fallbacks, a failed unit active in the boot still
bad); a unit-less fabric manager whose processes change (a transient extra process is no
restart, all replaced is one); the restart streak and its node_health_fm_restarted
event (island launcher and pool, tests/test_node_health_wiring.py); VPD FIFOs that never
answer (1 s each, 3 s in all); no boot id; older prev formats.

Mutation testing on the new code: the earlier rounds' 89 mutants that still
apply, 89 killed (9 more target code this round rewrote and are replaced by its own); this
round 51 (45 in node_health.py, 6 in the island and pool event wiring), 51 killed. One
more was equivalent and its condition removed from the code: the per-boot check on the
restart streak (a new boot's first check never counts a restart, so the streak is zeroed
anyway).

Gates

The customer path is unaffected: the node health check only runs on resident ssh islands
and node runtimes of the cuda family; it changes no rendered command.

🤖 Generated with Claude Code

michaellchung and others added 7 commits November 27, 2026 06:46
…down is lost

The cuda checker gave a fabric manager reason only on the check where it went
from active to inactive/failed; the next check was ok again, so a node whose
fabric manager stayed down never reached two bad checks in a row.

Now the checker keeps the boot in which the fabric manager must be active
(fm_boot, carried over read failures): once it was active in a boot, every
later check of that boot that does not read active is bad. A new boot id
forgets it, so a fabric manager never active since a reboot is judged as
before. The first read of a new launcher (no memory) on a node with an NVLink
fabric reports failed/activating/deactivating at once; inactive there is left
to the fabric state (it is also what a node without the unit prints). PCIe
nodes are never judged on a fabric manager that was never active. A prev from
an older check without fm_boot is read (the boot of its XID cursor).
HealthTracker is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ts restarts

Review follow-up.

- The fabricmanager section also prints the unit's NRestarts and the node's
  NVSwitch devices (/dev/nvidia-nvswitch<N>, else NVIDIA PCI bridges, class
  0680, in lspci). The first judged read of a new launcher is bad on a node
  with NVSwitch whenever the state is not active (inactive too); a node
  without NVSwitch (PCIe, an NVL72-class compute tray whose unit may be
  installed and failed) is not judged on a fabric manager never active in the
  boot. A probe that does not read judges nothing.
- A read whose state or NVSwitch probe did not read is not the first judged
  read (fm_judged, carried): the next one that reads is.
- fabric_manager_absolute(facts) -> (ok|bad|unread, detail): the rule on one
  check alone, from its own facts (nvswitch, fm_state: never carried), for
  callers without an earlier check.
- On a node that must run it, NRestarts that grew since the previous check of
  the same boot is a reason for that check, so a restart loop that reads
  active at every check is still caught.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rt baseline per boot

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…unknown for none

Review follow-up. On HGX B200 / B300 the NVSwitches are not PCIe devices of
the host (they sit behind a ConnectX bridge reached through NVLSM): no procfs
entry, no device file, no class 0680 bridge. The previous probe read that as
"no NVSwitch" and judged a failed fabric manager ok there.

- FM_SCRIPT probes /proc/driver/nvidia-nvswitch/devices, /dev/nvidia-nvswitch<N>,
  lspci class 0680 (no count when lspci fails), and the Mellanox devices: how
  many, how many VPD read, how many name the switch management port (SW_MNG).
- nvswitch_of(probe, gpu_names, fabric) -> (yes | no | unread, basis): no only
  for a GB GPU (NVL72-class tray), no real fabric state (PCIe), or every
  Mellanox VPD read without SW_MNG; yes for NVSwitch devices, SW_MNG, or B200 /
  B300 GPUs with a real fabric state; anything else unread, never no.
- fabric_manager_absolute reads facts["nvswitch"] (yes / no / unread); unread
  is never ok.
- A node with no NVSwitch of its own is never judged on its fabric manager,
  even after it was active in the boot.
- Fixtures follow an HGX B300 node as a non-root user sees it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review follow-up.

- systemctl is-active prints inactive for a unit that does not exist. The
  fabricmanager section now prints the unit's LoadState right after the
  state; inactive / failed count only for a loaded unit. A not-found unit
  (a GPU Operator driver container runs nv-fabricmanager; a shared NVSwitch
  VM runs it on its service VM) reads active when an nv-fabricmanager
  process runs, else "not running": a reason only in a boot in which it was
  seen active, unread at a first read (the fabric state judges the node).
- The VPD of every Mellanox function is read (the switch management port
  may be on any function), each read bounded to 1 s (none without timeout).
- B200 / B300 GPUs with a real fabric state are NVSwitch nodes even when the
  readable VPD does not name the port.
- A section cut off after the state line says so in the unread detail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… --value

Review follow-up.

- The nv-fabricmanager processes are counted whenever systemctl does not say
  active: a process that runs reads active, also next to a stale host unit
  that is disabled, inactive or failed (a GPU Operator driver container).
  No loaded unit and no process reads "not running"; hidden processes
  (hidepid) read nothing.
- LoadState and NRestarts are read with systemctl show -p and the prefix is
  cut: --value needs systemd 230.
- At one check, a fabric manager that is not running is bad when the node
  shows NVSwitch of its own (a device, a PCI bridge, the VPD port), ok when
  it does not and every GPU's fabric is Completed (managed off-host: a shared
  NVSwitch guest), else unread.
- A fabric manager without its unit: another process (pid and start time) in
  the same boot is a restart.
- The VPD reads stop after 3 s in all.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ents

- Read the unit's ActiveEnterTimestampMonotonic. On a node with soft NVSwitch
  evidence only (B300 without root, another NVIDIA 0680 bridge) and a Completed
  fabric, a loaded unit inactive/failed with no process is ok when it was never
  active in this boot (off-host), bad when it was, unread when unread.
- Under hidden processes a loaded unit that failed after being active in this
  boot stays failed; other hidden stops stay unread with one note.
- lspci 0680 devices: NVSwitch ids 10de:1af1 / 10de:22a3 are hard evidence;
  other NVIDIA bridges are soft (nvswitch yes, never hard).
- Container detection by systemd-detect-virt -c output, with /run/systemd/container,
  /.dockerenv and /run/.containerenv fallbacks.
- A unit-less fabric manager restarts only when every process of the previous
  check is gone.
- Each check of a restart streak emits node_health_fm_restarted (island launcher,
  node runtime log, pool via the health record) instead of a degraded note.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant