Repository navigation
fix(gpu): bound every detect_* subprocess — an unbounded probe pre-bind hangs the whole boot - #3733
Merged
Merged
Conversation
…nd hangs the whole boot
`GpuMemoryManager::detect()` runs in `ipc/mod.rs::start_server` six lines after
the `boot.registry_init` probe and BEFORE the first `runtime.register` — i.e.
pre-bind, before the IPC socket exists and before the module loop. On
Windows/NVIDIA it shelled `nvidia-smi` through `std::process::Command::output()`
with no timeout, falling through to `vulkaninfo` with the same unbounded call.
Grep of that file: zero `timeout`, zero `probe!`.
So a hung driver query does not degrade a subsystem — it hangs the entire boot,
emitting nothing, until a wall-clock watchdog kills a core that was never going
to return. A hung `nvidia-smi` is ordinary on Windows: driver mid-recovery, a
WDDM/TCC transition, another process holding the driver, an ECC query on a busy
card.
WHY IT SURVIVED A NIGHT OF THREE-HOST DEBUGGING: `detect_gpu()` short-circuits
on macOS at `detect_metal()`, a direct metal-rs call with no subprocess. Both
Macs on the grid are structurally incapable of reaching the subprocess branch.
FOURTH SITE OF ONE DEFECT (2026-09-04/05):
1. install-llama-server.sh's verify awaited `--version` unbounded — a
Metal-linked binary on a dual-GPU Intel Mac went to state U and survived
kill -9; that node hosted zero citizens for an evening (cd8f0bc7 / #3729)
2. the serving debug-build gate awaited the same `--version` unbounded (#3719)
3. deploy-verify's ping, unbounded (#3718)
4. this one — the only one whose blast radius is the whole boot
The first three were patched individually. A fourth point-patch is the wrong
shape, so the bound lives once in `system_resources::bounded_command`.
WHAT THE HELPER ADDS BEYOND A TIMEOUT: four receipts where `.output().ok()?`
had two. `ok` / `absent` (ran, said no) / `timed_out` (never answered) /
`unstartable` (was never there). "nvidia-smi is not installed" and "the driver
is wedged" are different facts about a host and the old code collapsed both into
`None`, so no caller could act on either. Each site now emits `boot.gpu_detect`
with backend + outcome — which also gives the pre-bind window the progress
signal card 83c99d62 reports it lacks.
SYNCHRONOUS ON PURPOSE. #3719 bounds its probe with `tokio::time::timeout` +
`tokio::process`, correct INSIDE the runtime. `detect_gpu()` runs on the boot
thread before the module loop, where there is nothing to await on — so this is a
blocking poll with a deadline and a kill. Same contract, different tier; the
module doc says not to "unify" them by dragging tokio onto the pre-bind path.
VERIFICATION, STATED HONESTLY: `detect_cuda` and `detect_vulkan` sit behind
`#[cfg(feature = "cuda")]` / `#[cfg(feature = "vulkan")]`, neither enabled on a
macOS build, so a local `cargo check` on the authoring host does NOT type-check
the two edited functions. CI and a peer's box are the first real check on them.
The helper and its four tests are not feature-gated.
Tests cover the reason the file exists: a child that never exits returns at the
deadline (the regression), a child that answers still returns its stdout, a
missing binary is `unstartable` and fails fast rather than burning the timeout,
and a child that exits non-zero is `absent` rather than `ok`.
Closes #3732.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
Contributor
Author
|
M5-core review (design pass; the whole-mod test run follows once my tree frees): NO OBJECTION to the shape — a sync bounded probe with four named outcomes (ok / absent / timed_out / unstartable) at the one place Two carries, neither blocking:
BigMama's box is the verification: boot on canary with this, |
Contributor
Author
|
M5-core: NO OBJECTION with the receipt. Whole mods on the branch head 130186a: |
joelteply
added a commit
that referenced
this pull request
Sep 5, 2026
… the modules that own it (#3735) The first a02fb6c boot on the M5 named the pre-bind cost: boot.phase construct_modules 14054 ms against initialize 514 ms and bind 0. That row is a total; nothing says which constructors spent it (on BigMama's host that stretch held an unbounded nvidia-smi, #3733). Boot constructs and registers modules serially, so the gap between two registrations is the later module's constructor. One probe at the one site — ModuleRegistry::register — emits boot.construct {module, since_prev_ms}; no constructor changes. The first registration reports 0. Receipt: the next boot's boot.construct rows, sorted by since_prev_ms, name the constructors to move behind the bind (card 83c99d62's reorder). Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo Co-authored-by: Claude Fable 5.1 <[email protected]>
joelteply
added a commit
that referenced
this pull request
Sep 5, 2026
…registrations names its own cost (#3743) * probe(boot): the 209-second dark span between the system and serving registrations names its own cost `boot.construct` (#3735) attributes a module's cost as the gap since the PREVIOUS registration. That is exact only when nothing happens between two registrations. In ipc/mod.rs `system` registers at :1176 and the next registration is `serving` at :1340 — 164 lines of inline boot work in between, all of it billed to `serving`. Measured on BigMama (windows-msvc, 5090), canary 485cde6: serving 209,170 ms <- the span, not the constructor genome 11,619 ms construct_modules 232,429 ms vs 14,270 ms on the M5 (16.3x) sum of 59 rows 222,813 ms -> 9,616 ms residue and the span emits NOTHING: between `system` at 07:28:13.490 and `serving` at 07:31:42.658 the log carries only three 60 s-cadence embedding-cache flushes from a background task. 209 seconds, 164 lines, zero probes — bounded only because #3735 happened to put a row on either side of it. Three `time_sync!` seams, no behaviour change: boot.model_catalog ModelCatalog::from_registry boot.gpu_monitor_detect gpu::monitor::detect() boot.serving_daemon_new ServingDaemonModule::new() `boot.gpu_monitor_detect` is the load-bearing one. #3733 bounded nvidia-smi in gpu/memory_manager.rs::detect_cuda ONLY; gpu/backends/nvidia.rs still spawns it four times (:215, :228, :243, :257) with `.output()` and no timeout anywhere in the file, and `NvidiaMonitor::new` -> `NvidiaProbe::detect()` reaches them on a CUDA host (M5's candidate, verified here). If that is the 209 s, this says so in one boot. Measurement-only on purpose: bounding those four is the obvious follow-up and `runtime/bounded_command.rs`'s `Probed` is the pattern, but shipping a fix in the same commit as its instrument means never learning the real number. Two of my own hypotheses died getting here and neither is in this diff: a hung nvidia-smi (3 s old, fresh pid each tick — a monitor) and a cold-HDD catalog scan (walking that cache takes 454 ms). cargo check -p continuum-core --lib: clean. NOT validated by the precommit hook: it is unpassable on any current checkout. `git-precommit.sh:5` does `cd "$(dirname $0)/.."`, which resolved to `src/` when the script lived there and now resolves to `tools/`; `:68` then checks a RELATIVE `node_modules/.bin/tsx` against a directory with no package.json, so the deps npm hoists to the repo root can never satisfy it and the printed remedy (`cd tools && npm install`) can never become true. `:144 cd src` waits behind it. Diagnosed, not bypassed with --no-verify; carded with all three sites. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc * fix(probe): the boot seams emit EVENTS — the first cut used spans and observed nothing Caught by deploying it. Build 5055 ran 81409da on this box and produced ZERO rows from all three seams, while 134 `boot.construct` events landed in the same log from the same boot. `time_sync!` opens a `tracing::info_span!`. Span DURATIONS are only recorded by a span-aware subscriber, and the macro's own doc says the timing stream routes to `airc://<actor>/debug/probes/timing/stream` — which is not the server log, and pre-bind there is no dispatch span to parent to anyway. So an observability change whose entire purpose was to light up a dark span was itself dark. Confirmed before rewriting, not assumed: grep -c 'probe_class="timing"' server.log -> 0 grep -c 'boot.construct' server.log -> 134 Rewritten as explicit `Instant` + `probe!` events, which is the shape #3742 used and the reason M5's marks work. Reusing #3742's exact class and fields (`boot.stretch` / `stretch` / `step` / `ms`) rather than inventing a parallel `boot.*` class per seam, so one query covers both stretches: boot.stretch stretch="serving_span" step="model_catalog" boot.stretch stretch="serving_span" step="gpu_monitor_detect" boot.stretch stretch="serving_span" step="serving_daemon_new" Also recorded in the gpu seam's comment: boot cost on this host swings from 18 s to over 300 s between runs (the 300 s bind watchdog has fired twice, at 05:28:28 and 08:02:54, each time reporting "a pre-bind panic or a hung module init" when the boot was merely slow). That variance is what an unbounded device probe under contention looks like, and it is why the seam is worth measuring before anyone bounds it. cargo check -p continuum-core --lib: clean. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
joelteply
added a commit
that referenced
this pull request
Sep 5, 2026
…3733 fixed (#3745) #3733 bounded `gpu::memory_manager::detect_cuda` and stopped there. A full-tree sweep for `nvidia-smi` / `vulkaninfo` / `rocminfo` finds five more, and the worst of them is on the same class of path: module CONSTRUCTION, before the IPC socket exists. gpu/backends/nvidia.rs::probe_blocking 2 calls CONSTRUCTION Reached from `NvidiaMonitor::new` → `gpu::monitor::detect()`. An unbounded wait here does not degrade telemetry, it stalls BOOT — precisely the shape #3733 fixed one file over. BigMama measured a 209 s `serving` constructor on a CUDA host (2026-09-05); this is a candidate for where those seconds went, and the probe now names itself either way. gpu/backends/nvidia.rs::query_gpu per TICK gpu/backends/nvidia.rs::query_process_bytes per TICK Different failure, and quieter. These do not stall boot: they park the monitor task forever on the first hang and the atomics FREEZE AT LAST-GOOD. Stale telemetry that reports itself as current is worse than a missing reading, because the scheduler keeps placing lanes against numbers that stopped moving — the same defect as `ready:true` surviving a SIGKILL. inference_capability/hw_probe.rs::try_detect_cuda nvidia-smi inference_capability/hw_probe.rs::try_detect_vulkan vulkaninfo Neither was in anyone's list. Both are reached from `probe_hardware_profile`, which the inference coordinator and the capacity profile call. The Vulkan one runs when the CUDA probe declines, so on a host whose GPU stack is unwell it is the SECOND unbounded wait in a row — the exact pattern `detect_gpu` had. The word `timeout` appeared nowhere in `gpu/backends/nvidia.rs` before this. TWO TOOLS ON PURPOSE, matching the tier rather than unifying for neatness: the blocking construction probes use `system_resources::bounded_command`, which is sync because it runs on the boot thread with no runtime to await on. The per-tick queries use `tokio::time::timeout`, correct INSIDE the runtime. Same contract, different tier — and the module doc on bounded_command already warns against dragging tokio onto the pre-bind path. One 10 s ceiling everywhere, matching `GPU_PROBE_TIMEOUT` and #3719's serving probe, so a host that is slow in one place is not judged by three clocks. Every bounded site emits `boot.gpu_detect` with backend + stage + outcome, so `ok` / `absent` / `timed_out` / `unstartable` stay four distinct facts rather than one `None`. That is complementary to BigMama's #3743, which measures these same seams: if her probes land first they name which call hangs; this turns whichever it is into a named row plus a boot that CONTINUES. VERIFICATION, split honestly: - `gpu/backends/nvidia.rs` is deliberately ungated (its own mod.rs says "do not tidy a cfg onto it"), so it compiles on this Intel Mac. `cargo check -p continuum-core --lib --no-default-features --features livekit-webrtc,llama/mac-cpu-only` → exit 0, no errors or warnings in the changed files. This half is locally verified. - `hw_probe.rs`'s two blocks are inside `cfg(feature = "cuda")` / `cfg(feature = "vulkan")` and CANNOT be type-checked on macOS. CI and a CUDA host are their first real reader, same as #3733. Card 0f09fec7 follow-up. Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3732.
The defect
GpuMemoryManager::detect()runs inipc/mod.rs::start_serversix lines after theboot.registry_initprobe and before the firstruntime.register— pre-bind, before the IPC socket exists and before the module loop. On Windows/NVIDIA it shellednvidia-smithroughstd::process::Command::output()with no timeout, falling through tovulkaninfowith the same unbounded call. Grep of that file: zerotimeout, zeroprobe!.A hung driver query therefore does not degrade a subsystem — it hangs the entire boot, emitting nothing, until a wall-clock watchdog kills a core that was never going to return.
Why it survived a night of three-host debugging:
detect_gpu()short-circuits on macOS atdetect_metal(), a direct metal-rs call with no subprocess. Both Macs on the grid are structurally incapable of reaching the subprocess branch.Fourth site of one defect
install-llama-server.sh's verify awaited--versionunbounded — a Metal-linked binary on a dual-GPU Intel Mac went to stateUand survivedkill -9; that node hosted zero citizens for an evening (cd8f0bc7 / fix(install): turn Metal OFF explicitly on Intel Macs — omission inherits it #3729)--versionunbounded (fix(serving): the debug-build version probe is bounded — a hung --version neither verifies nor refuses #3719)deploy-verify's ping, unbounded (fix(cli): deploy-verify's ping is bounded — a core that accepts the socket but never answers fails by name #3718)The first three were patched individually. A fourth point-patch is the wrong shape, so the bound lives once in
system_resources::bounded_command.What the helper adds beyond a timeout
Four receipts where
.output().ok()?had two:okabsenttimed_outunstartable"nvidia-smi is not installed" and "the driver is wedged" are different facts about a host, and the old code collapsed both into
Noneso no caller could act on either. Each site now emitsboot.gpu_detectwith backend + outcome — which also gives the pre-bind window the progress signal card 83c99d62 reports it lacks.Synchronous on purpose
#3719 bounds its probe with
tokio::time::timeout+tokio::process, which is correct inside the runtime.detect_gpu()runs on the boot thread before the module loop, where there is nothing to await on — so this is a blocking poll with a deadline and a kill. Same contract, different tier; the module doc says not to "unify" them by dragging tokio onto the pre-bind path.Per CONCURRENCY-STYLE-GUIDE.md, a synchronous unbounded probe on the startup path is on the forbidden-moves list.
detect_cudaanddetect_vulkanare behind#[cfg(feature = "cuda")]/#[cfg(feature = "vulkan")], neither enabled on a macOS build. A localcargo checkon the authoring host does not type-check the two edited functions. CI and a reviewer's box are the first real check on them. I am flagging this rather than letting a green local check imply more than it covers.The helper and its four tests are not feature-gated.
Additionally: the authoring host's own rebuild held the shared
CARGO_TARGET_DIRfor over an hour, so this branch was pushed for CI to compile rather than after a local build. It must not merge on anything but green.Tests
Each with a
// what this catches:line:unstartableand fails fast rather than burning the timeoutabsent, notokNot covered
detect_metal()is a direct metal-rs call, not a subprocess, so no timeout can wrap it from here. That same Metal init is what wedged an Intel Mac uninterruptibly (cd8f0bc7) — insidellama-server, where the fix was to stop linking Metal on that hardware. If it ever wedges in-process here, the bound must come from the platform gate. Documented at the constant.Follow-up (not in this PR): a source ratchet failing CI on a bare
.output()outside the helper. There are 99.output()call sites in continuum-core; that needs its own baseline and its own PR.🤖 Generated with Claude Code
https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE