Skip to content

lane host: --stall-seconds marks a stalled engine unavailable, --stall-exit restarts it - #3165

Open
ashhart wants to merge 4 commits into
mainfrom
lead/stall-sentinel-keepalive
Open

ashhart wants to merge 4 commits into
mainfrom
lead/stall-sentinel-keepalive

Conversation

@ashhart

@ashhart ashhart commented Nov 13, 2026

Copy link
Copy Markdown
Owner

Closes #3112.

A lane-host engine that stops making progress (a hung device call, a lost peer) kept answering /health 200 while every request waited. New opt-in flags:

  • --stall-seconds N watches each round on the shared lane host. A round in flight longer than N seconds marks the engine unavailable: /health returns 503, new requests get 503, and tensorfold_engine_stalls_total counts it.
  • --stall-exit also exits the process with status 70, so a supervisor restarts it. The exit skips atexit handlers, so nothing waits on the stalled device.

Idle waits are outside the round scope, so idle time never counts as a stall, and idle unload isn't triggered by the status read. With the flag off, the cost is one atomic load per round and per submit, and the metrics output is unchanged. SSE keep-alives already exist (: keepalive on OpenAI streams, ping on Messages) and are unchanged. Flash Next on Metal, LFM2 and drama don't use the shared lane host, and they refuse the flag by name.

Known limit, documented and tested: a family that fills a long prompt in one call holds one round for it, so N must exceed the slowest such call. With --stall-exit, an N set too low restarts a healthy server.

Tests: test-lane-stall-host 28 + 25; test-lane-api-host 601; test-server-cpu 1343 pass, 7 skip; test-dsv41-device-host 221 pass, 2 skip; a forked-process test that --stall-exit ends with status 70. The new tests use APIs main doesn't have.

Device check pending (GB10 and a Mac lane-host family): flag off, metrics and replies byte-equal to main; with --stall-seconds 120 at 1 and 4 streams, tokens equal, decode level, /health 200 and no stalls through long prompts.

…ine root too

On macOS the server's core import is zig/src/tensorfold.zig, which re-exports core's files one by one, so @import("core").stall_timeout compiled on CUDA and Linux but not in the Metal build. tensorfold.zig now re-exports it as well.
Use the supplied paired backend/sentinel scope in the extracted lane loop, and let the shared idle helper close either scope shape before main weight release and idle waits.
@ashhart
ashhart force-pushed the lead/stall-sentinel-keepalive branch from 7dcfb9f to c13d3d4 Compare November 26, 2026 22:24

This branch has not been deployed

No deployments
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.

Engine stall sentinel, generation health and SSE keep-alive

1 participant