← Back to Pull requests

fix(reload): wait for dependent replica retirement before advancing rollout #6096

Closed
unknown closed this pull request without merging on Nov 14, 2026 14:22 UTC
View on GitHub
unknown unknown commented on Nov 13, 2026 03:51 UTC
Author

Rolling reload can fail the next replica's capacity check while the preceding replica's old engine still holds GPU memory. Replacement returns after route cutover, while retirement continues asynchronously, allowing the next replica to check capacity before those allocations are released.

The reload documentation describes updating replicas one at a time and retrying partial rollouts.

Wait for a committed replica’s previous generation only before a later replacement that depends on its allocations. Dependence means overlapping GPU indices on the same Worker, or a shared actor process. The worker’s automatic and explicit allocation records supply the actual GPU indices; launch-time gpu_idx=None is not treated as a device. Independent Workers and disjoint known GPU sets proceed while old requests finish. An independent replica can also advance before a later replica that shares the earlier GPU.

When placement cannot be determined, bound each retirement wait at 300 seconds. This separate bound does not reuse drain_timeout. Expiry returns a retryable partial error: committed replicas stay ready, later replicas are skipped, and old requests and cleanup continue. Known shared allocations still wait for retirement without a deadline. Cleanup failure also stops advancement without undoing committed replicas. Cancellation shields retirement cleanup.

Recheck for failed replicas after each retirement wait and immediately before starting the next replacement. If a committed replica rolls back during the wait, stop the remaining waits and skip untouched replicas. Successful replicas retain their new settings, the failed replica reports its rollback, and the rollout returns an error with partial=true when some replicas remain successfully updated.

Before the first cutover, preflight verifies retirement-wait support on every original actor whose retirement a later replacement may need. The capability probe and wait both check the original address and UID, so forwarding by an older retained actor cannot establish support. Missing, incompatible or forwarded support fails preflight with a restart message before any replica changes.

GPU memory accounting is unchanged. Reapplying unchanged non-hot settings still replaces the engine. Parser-only updates, single-replica reloads and final-replica retirement retain their existing behavior. Retained-weight replacement remains limited to vLLM and SGLang; their shared and separate weight-cache capacity paths are covered. Transformers, llama.cpp, MLX, TRT-LLM and non-LLM engines do not enter this path under the existing retained-weight eligibility check. P/D and replicas sharded across Workers remain unsupported by this integration.

Regression coverage holds an old request open while both independent replicas complete, with explicit and automatic assignment and different Workers. It also checks a nonadjacent dependent replica, bounded unknown placement without cancelling cleanup, identity-checked capability probes, and older-actor rejection before any replica changes. A three-replica rollback regression asserts ready / error / skipped and verifies that the final replica's replacement is never called. Existing tests retain shared-GPU completion, cleanup failure, cancellation, actor streams and vLLM/SGLang capacity coverage.

Validation of the current change:

  • Ubuntu 24.04.5 LTS, the branch head b45e807b (checked as one squashed commit with the same tree) against 3e210848: 108 changed-file tests passed on Python 3.12.3 with Transformers 5.23.0, 108 with Transformers 4.57.6, and 108 on Python 3.10.22.

  • The 52 launch-strategy consumer tests passed on Linux Python 3.12. Pre-commit checks passed, including formatting, lint, import order, types, spelling and platform coverage.

  • Changed tests against base production code failed as expected.

  • The new rollback regression failed on 9ae1eb87 with ready / error / ready and passed with this change on Windows Python 3.10.20 and 3.14.6.

  • On both Windows interpreters, test_replica_reload.py passed 55 tests and test_model_reload.py passed 46. test_model_generation.py passed 52 tests with one existing POSIX PATH-separator assertion failure, also reproduced on 9ae1eb87.
  • Earlier validation:

  • Ubuntu 24.04.5 LTS, branch head 9ae1eb87 checked as a squash with the same tree against 3e210848: 107 changed-file tests passed on Python 3.12.3 with Transformers 5.23.0, 107 with Transformers 4.57.6, and 107 on Python 3.10.22.

  • The 52 launch-strategy consumer tests passed on Linux Python 3.12. Formatting, lint, import-order, type, spelling and platform-coverage checks passed.

  • Changed tests against base production code failed as expected.

  • Windows Python 3.10.20 and 3.14.6 each passed 229 reload, model-generation, launch-strategy and component-upgrade tests after excluding two failures also reproduced on 666ce06e: a POSIX PATH-separator assertion and installed worker-upgrade acceptance requiring unavailable native Xoscar handoff support.

  • Against 666ce06e, the final Windows regression selection produced 13 expected failures and seven passing controls on each interpreter, apart from those two baseline failures.

  • Documentation (Linux, after pip install -e ".[doc]"): all ten modified catalogs passed msgfmt --check --check-format; python doc/build_i18n.py --all compiled every locale; the changed page built with Sphinx in English and in all nine maintained locales, and the new paragraph renders in English and Simplified Chinese. No build warning points at the new paragraph.
  • The GPU evidence below predates these follow-ups and validates the original shared-GPU retirement fix.

    Real-model GPU validation used one RTX PRO 6000 Blackwell with 96 GB, Python 3.12.15, vLLM 0.33.0, PyTorch 2.14.0+cu130 and xoscar 0.12.4. Two retained-weight Qwen3-0.6B replicas shared GPU 0, with max_model_len=4096 and initial max_num_seqs=32. Each attempt submitted {"model_config":{"max_num_seqs":64}}, including repeated unchanged submissions. VLLM_USE_FLASHINFER_SAMPLER=0 was set.

    The same environment ran base, the patch for 239508e7, and base again. Imported source-file hashes matched the corresponding production modules.

    | Run | gpu_memory_utilization | Reload results | Successful short requests | Failed short requests |
    | --- | --- | --- | --- | --- |
    | Base #1 | 0.3 | Three partial failures | 1179 | 0 |
    | Fixed revision | 0.3 | Three ready | 1915 | 0 |
    | Fixed control | 0.2 | Two ready | 1319 | 0 |
    | Base #2 | 0.3 | Three partial failures | 1151 | 0 |
    | Base control | 0.2 | Two ready | 1249 | 0 |

    Both base runs failed the second replica's capacity check while the preceding engine was retiring: 7.58–9.25 GiB was free against a 27.88 GiB requirement. Memory became sufficient after retirement.

    With the fix, the second replica started 3.88–4.56 seconds after the first replica's completion marker, following the preceding engine-manager shutdown. GPU memory and PID samples showed the old allocations being released. Both replicas acquired new engine PIDs on every attempt.

    The initial per-attempt streams finished before cutover. A supplementary fixed run kept streams running continuously through two more successful reloads at 0.3. It recorded 1328 successful short requests and 116 streams with no recorded HTTP or transport errors; four stream intervals overlapped replica-completion timestamps. Stream records do not identify the serving generation or explicitly validate terminal SSE markers. The actor regression separately verifies that an old stream retains its generation until completion.

    Every recorded whole-model termination returned GPU memory to the pre-launch baseline of 0 MiB.

    Timing evidence combines replica status timestamps, shutdown logs and GPU memory/PID samples; there is no dedicated capacity-entry timestamp. SGLang and separate-weight-cache replacement were covered by CPU tests, not GPU runs.

    AI disclosure: this was prepared with AI assistance (Claude Opus 5.5 and Claude Sonnet 5.5).

    🤖 Generated with Claude Code

    https://claude.ai/code/session_01JfvcPZyKcKQUG9fQGYfRMw

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: Jackmeson1 Review duration: 2071m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #6096"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 22.5% · Safe to merge
    22.5%