Repository navigation
zmnext: zm-infer start failures, spawn serialization, no host-wide orphan kill; Phase 2 plan - #289
Open
SteveGilvarry wants to merge 5 commits into
Open
SteveGilvarry wants to merge 5 commits into
SteveGilvarry wants to merge 5 commits into
Conversation
…s comment ensure_infer_daemon discarded start_daemon_with_stdin's result, which returns Ok(error response) (not Err) for executable-not-found / invalid-spec and creates no ManagedProcess entry — so a misconfigured zm-infer path was a permanent, silent fleet-wide detection outage (never restarted by check_daemons, never retried by reconcile, while the worker ran on). Propagate it as Err (with an is_running re-check for the legitimate already-running race) so start_zmnext_worker aborts and reconcile retries. Also correct the hung-check comment: the daemon's gray-hang liveness is enforced by its own watchdog (Increment 4), not an app-level probe. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ll (Inc 4 mediums) - M2: add infer_spawn_lock and hold it across ensure_infer_daemon's is_running check + spawn, so concurrent worker starts (reconcile + an API request) can't both pass the read-check and double-spawn the daemon past start_daemon_with_stdin's TOCTOU. Pairs with the daemon's flock (zm-next) which makes the loser exit cleanly. - M8: drop "zm-infer" from kill_orphan_daemons' blanket `pkill -9` — a host-global kill would take down a co-located zm-api instance's daemon. Its lifecycle is covered by PR_SET_PDEATHSIG (dies with this zm-api) + the daemon's flock. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Records the Phase-2 scoping outcome: defer (3/3 adversarial verdicts worth_it:no). Motion-gating killed the PCIe-saturation premise, and the daemon's mandatory d_batch_ staging copy survives every design, so CUDA-IPC only converts that H2D to a D2D and drops the worker D2H + UDS bytes — net ~1-2 ms latency on Gen3 single-GPU, zero throughput/memory, at the cost of regressing the SPOF daemon's fault isolation. Captures the cheap pinning precondition (do as hardening), the instrumentation to ship now, and the T1-T4 re-open trigger + the CUDA-IPC design for if it ever fires. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…built Records as-built status for both (zm-next fde326d): the daemon's dedicated cudaHostAlloc RX buffer (vs the original cudaHostRegister sketch, which the design panel found UAF-prone), sync-from-pinned (async rejected), stderr-only instrumentation with per-instance accumulators + an async logger guarding the SPOF dispatcher, and the first empirical h2d_frac_p99 (~0.1-2%, well under the 20% T1 trigger) confirming DEFER. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The plan cited zm-next fde326d and its internals (read_frame_into, PongStats, a cudaHostRegister'd worker buffer, pinned=K/N), a June commit that never reached zm-next main. The work landed as e9611e8 and its three predecessors on 2026-11-29: describe that, add its measurements, and say the watchdog is the daemon's --watchdog-sec, not a thread. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
zm-api's side of the shared-inference hardening that landed in zm-next on 2026-11-29 (zm-next
6b757a9,33bc1f7,b4ddc2c,e9611e8).Code (
src/daemon/manager.rs)start_daemon_with_stdinreturnsOkwith an error response, and no managed process, when the binary is missing or the spec is invalid, socheck_daemonscould never restart it. Now, if the daemon really isn't running,start_zmnext_workergets anErrand the worker stays down for reconcile to retry, rather than running with detection silently broken.infer_spawn_lock), so reconcile and an API start can't both pass the is-running check and spawn two. zm-next's daemon now also holds an flock beside its socket, so a second one exits 69 either way.kill_orphan_daemonsno longer killszm-inferacross the host. A host-widepkill -9 zm-inferwould kill another zm-api's daemon on the same machine. Ours dies with zm-api throughPR_SET_PDEATHSIG.--watchdog-secwith none finishing, andcheck_daemonsrestarts it. That's why the CPU-time hang check skipszm-infer.Docs (
docs/ZMNEXT_SHARED_INFERENCE_PLAN.md)Phase 2 (same-GPU zero-copy) is scoped as deferred and gated on measurements. The precondition (pinned receive buffers, one copy into the batch) and its instrumentation are recorded as built in zm-next
e9611e8, with the measurements: pinning cut round trips from 42 to 9.7 ms (p50) under a synthetic 6-client load.Testing
cargo fmt --all -- --check,cargo clippy --locked --all-targets --all-features -- -D warnings: cleancargo test --locked --all-features: 1434 passed, 0 failed (DB-backed#[ignore]tests not run locally)🤖 Generated with Claude Code