Skip to content

fix: prevent stranded prefill requests after subprocess failure - #239

Draft
gspark-etri wants to merge 1 commit into
feat/236-atom-single-pdfrom
fix/238-prefill-worker-failure
Draft

gspark-etri wants to merge 1 commit into
feat/236-atom-single-pdfrom
fix/238-prefill-worker-failure

Conversation

@gspark-etri

Copy link
Copy Markdown
Collaborator

Background

A cancelled prefill Future, JSON-formatted SDK log or malformed reply can terminate the subprocess receiver and strand later serving requests. Startup failure can leave shared memory or a child process behind.

Changes

  • Ignore non-protocol JSON logs, handle cancelled responses safely, and fail all pending Futures on terminal pipe/protocol errors.
  • Reject subsequent requests through failed Futures; serialize pipe writes without holding the response-map lock.
  • Clean up failed startup and terminate/kill the owned worker before releasing its slab. Closing is idempotent.
  • Add nine real subprocess fault scenarios, including explicit healthy replacement; preserve the existing request/reply and KV layouts.

Verification

Baseline df02223: the nine new scenarios fail (three receiver-thread warnings and one cleanup error). Candidate: 64 focused PD/ATOM/serving tests pass, including actual tiny Torch subprocess prefill. Final full suite: 460 passed, 15 skipped, 135 subtests passed, one existing flex_attention warning (134.34 s). Test-file Ruff and git diff --check pass.

Commands and outcomes are in opt_prime/examples/pd/http_matrix/experiments/2026-10-23-prefill-worker-failure238.md.

Compatibility and limits

Stacked on #237. CPU process lifecycle evidence only: no accelerator reset, automatic request replay/restart or throughput claim. The four-model live hardware queue remains on its pinned implementation under #234; this change is not silently injected into that running experiment.

The repository-wide sensitive scan has four unchanged baseline findings; the files introduced/changed by this PR are checked separately before push.

Related Issue

Closes #238

gspark-etri added a commit that referenced this pull request Oct 30, 2026
…#246, #249) (#282)

From feat/249-pd-stage-metrics (#239, #247, #250): SubprocessPrefillWorker
failure settling, producer readiness gating /ready and admission, producer
stage-duration metrics; only the /ready hunk of llmd.py.

Fixes on top:
- SubprocessPrefillWorker.close() closes stdin and waits for a clean exit
  before SIGTERM, then SIGKILL (prefill_server exits on stdin EOF; SIGTERM
  first skipped SDK cleanup that releases the device).
- ProcessPrefillWorker.ready: a dead child now fails readiness and admission
  is rejected with 503 instead of quarantining the batcher.

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