Repository navigation
[serve][in-place-updates][1/n] Keep old replicas routable after a failed rolling in-place update - #66252
Conversation
There was a problem hiding this comment.
Code Review
This pull request ensures that surviving replicas continue to receive traffic and remain available even after a rolling update fails terminally. This is achieved by updating the availability logic in deployment_state.py to check if there are any running replicas. Additionally, new integration and unit tests are added to verify this behavior. The review feedback suggests using the idiomatic dict.copy() method instead of copy() in the test file to avoid potential import issues.
|
The change is good. Two things belong in the description before it merges. First, the scope. This only helps when the rollout leaves a surviving old replica, so Second, and worth a release note, the deployment now sits at reduced capacity indefinitely, serving stale code under a On the integration test, And the bot comment seems reasonable to apply. |
c3946a2 to
d8191c3
Compare
good idea, I updated the description and addressed the bot comment. |
…update `is_available` was derived from `_terminally_failed()` alone, so once a rolling update hit the replica startup threshold the routers rejected every request (HTTP 503) although the old-version replicas that were not replaced yet were still RUNNING and in the broadcast running set. A deployment is now unavailable only when it is terminally failed *and* has no running replica, which keeps fresh deploys and scale-from-zero (ray-project#51600) unchanged. Tests: unit test on the broadcast payload after a failed rolling update (fails on master with is_available=False) and an integration test that keeps getting 200 from the surviving replica after DEPLOY_FAILED, for both a rebuild-class and a replica-restart-class update (fails on master with 503). Signed-off-by: Qisheng He <[email protected]>
d8191c3 to
bfd103e
Compare
…led rolling in-place update (ray-project#66252)
…rcent` for start-before-stop rolling updates (#66267) (#67094) Cherry-pick of #66267 (master commit 9491664) onto `releases/2.60.0`. ## Why The first three PRs of the in-place-updates series (#66252, #66290, #66266) are already on `releases/2.60.0`. This picks the fourth, which adds `max_surge_percent` for start-before-stop rolling updates, so 2.60.0 ships the complete series. ## Cherry-pick details `git cherry-pick -x` conflicted in one file, `python/ray/serve/tests/unit/test_deployment_state.py`. The conflict was positional only: on master, #66243 (push-based replica health) had appended `TestPushedHealthEndToEnd` and related tests to the end of that file, and #66267 inserts `TestMaxSurge` right before them. This branch doesn't have #66243, so git couldn't anchor the hunk and offered the #66243 tests as part of the incoming side. Resolved by inserting only the PR's `TestMaxSurge` block (plus its `defaultdict` import) before the `__main__` guard. The added and removed lines in each of the 17 files are identical to the master commit's diff. After the pick, 11 of the 17 files are byte-identical to master at 9491664. The other 6 differ only by master commits that aren't on this branch and that #66267 doesn't depend on: - `_private/deployment_state.py`, `tests/unit/test_deployment_state.py`: #66243. - `schema.py`, `tests/BUILD.bazel`, `tests/test_controller.py`, `tests/test_direct_ingress.py`: #66339 and #66940. No commit on `releases/2.60.0` after the branch cut touched any of these files. Not a duplicate: no PR against `releases/2.60.0` references #66267. ## Testing Run on this branch with the Serve protobuf regenerated from the branch's `serve.proto` (the pick adds the `max_surge_percent` field). ``` python -m pytest python/ray/serve/tests/unit/test_deployment_state.py python/ray/serve/tests/unit/test_config.py python/ray/serve/tests/unit/test_deployment_class.py python/ray/serve/tests/unit/test_schema.py 3530 passed, 12 skipped ``` ``` python -m pytest python/ray/serve/tests/test_deploy_app_3.py python/ray/serve/tests/test_deploy_app_2.py -k surge 13 passed, 41 deselected in 282s ``` `pre-commit run --files <changed files>` passed. AI assistance was used to prepare this cherry-pick. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Qisheng He <[email protected]> Signed-off-by: qishengxhe <[email protected]>
Summary
A failed rolling update can leave healthy replicas from the previous version running, but Serve marks the deployment unavailable and rejects requests with HTTP 503.
This change keeps the deployment available while it has running replicas. Health checks continue as usual, and unhealthy replicas are removed from routing.
This preserves traffic through surviving replicas. It does not restore full capacity or automatically roll back the update. If no replicas survive, the deployment remains unavailable. A caller, such as the control plane, must redeploy a healthy configuration to recover.
Tests
Added a unit test for router availability and integration tests covering application rebuilds and runtime environment changes.
The new test sends continuous traffic through D1 → D2 during a healthy update, a failing update in D2, and an explicit rollback. It checks that no requests fail and both deployments recover fully.
All four integration cases passed. Removing the fix makes both new cases fail with HTTP 503s. The original deployment state unit suite passed all 259 tests.
Also tested on a real cluster with the next two commits in this series: no requests failed, compared with about 45 HTTP 503s per failed update on an unmodified image.
Duplicate check
Searches for open PRs about
is_availableand rolling updates, including changes to the same code indeployment_state.py, found no overlapping fix.AI assistance
Claude Code assisted with the implementation. I reviewed every changed line and ran the tests listed above locally.