Repository navigation
[serve] Drop dead replicas from the multiplexed model ID mapping - #66358
Merged
jeffreywang88 merged 2 commits intoSep 22, 2026
Merged
jeffreywang88 merged 2 commits into
jeffreywang88 merged 2 commits into
Conversation
Signed-off-by: GINTOAHC <[email protected]>
Contributor
There was a problem hiding this comment.
Code Review
This pull request ensures that when a replica actor dies, its replica ID is discarded from the multiplexed model ID mapping in the request router. This prevents subsequent requests for that model from raising a KeyError before the controller broadcasts the updated replica set. A unit test has been added to verify this behavior. There are no review comments, so I have no feedback to provide.
jeffreywang88
approved these changes
Sep 22, 2026
jeffreywang88
left a comment
Contributor
There was a problem hiding this comment.
Thanks for your contribution @GNITOAHC!
owenowenisme
pushed a commit
to owenowenisme/ray
that referenced
this pull request
Sep 23, 2026
…-project#66358) ## Description `on_replica_actor_died` clears the replica set, the cached replica list and the locality sets, but it misses `MultiplexMixin._multiplexed_model_id_to_replica_ids`. That mapping is only rebuilt in `update_replicas`, so between the router noticing a replica died and the controller broadcasting a new replica set, it still points at a replica that is already gone from `self._replicas`. The next request for one of that replica's models picks it anyway and blows up on the lookup in `pow_2_router.py`: ``` ERROR ... -- Unexpected error in _fulfill_pending_requests. KeyError: Replica(id='r1', deployment='...', app='...') ``` `_fulfill_pending_requests` swallows that, so the routing task just exits and its request is never fulfilled. This drops the dead replica from the mapping too, the same way `_discard_colocated_replica_ids_on_replica_actor_died` already handles the locality sets. ## Related issues No existing issue. ## Additional information Tests run. ``` pytest python/ray/serve/tests/unit/test_pow_2_request_router.py python/ray/serve/tests/unit/test_router.py python/ray/serve/tests/unit/test_consistent_hash_router.py python/ray/serve/tests/unit/test_capacity_queue.py 297 passed ``` Signed-off-by: GINTOAHC <[email protected]>
nadongjun
pushed a commit
to nadongjun/ray
that referenced
this pull request
Oct 6, 2026
…-project#66358) ## Description `on_replica_actor_died` clears the replica set, the cached replica list and the locality sets, but it misses `MultiplexMixin._multiplexed_model_id_to_replica_ids`. That mapping is only rebuilt in `update_replicas`, so between the router noticing a replica died and the controller broadcasting a new replica set, it still points at a replica that is already gone from `self._replicas`. The next request for one of that replica's models picks it anyway and blows up on the lookup in `pow_2_router.py`: ``` ERROR ... -- Unexpected error in _fulfill_pending_requests. KeyError: Replica(id='r1', deployment='...', app='...') ``` `_fulfill_pending_requests` swallows that, so the routing task just exits and its request is never fulfilled. This drops the dead replica from the mapping too, the same way `_discard_colocated_replica_ids_on_replica_actor_died` already handles the locality sets. ## Related issues No existing issue. ## Additional information Tests run. ``` pytest python/ray/serve/tests/unit/test_pow_2_request_router.py python/ray/serve/tests/unit/test_router.py python/ray/serve/tests/unit/test_consistent_hash_router.py python/ray/serve/tests/unit/test_capacity_queue.py 297 passed ``` Signed-off-by: GINTOAHC <[email protected]>
1 task done
chia7712
pushed a commit
to opensource4you/readme
that referenced
this pull request
Nov 25, 2026
fellowship: 提名 GNITOAHC (ray, 2026-11) 建議等級 2 萬 - [x] 關係人宣告:提名人與被提名者無親屬、僱傭、財務、業務合作或其他可能影響公正判斷之利害關係 - 在兩個月內自己從 Ray Serve 原始碼找到 9 個 bug 並開了 PR,其中 6 個 PR 被 Merged ([Merged PRs](https://github.com/ray-project/ray/pulls?q=is%3Apr+author%3AGNITOAHC+is%3Amerged+merged%3A%3C%3D2026-11-24)) - 開了 Gang Scheduling + Autoscaling 的 Issue 並附上 Repro Script,社群後續依此開 PR 修復,提名人則變成該 PR 的 Reviewer ([#67494](ray-project/ray#67494)) - PR Description 簡潔清楚,讓 Reviewer 清楚理解 PR 解決了什麼問題 ([#66358](ray-project/ray#66358), [#66438](ray-project/ray#66438), [#66616](ray-project/ray#66616), [#66910](ray-project/ray#66910)) - 對於 Maintainer 的 Review 會清楚了解之後回覆 ([#67923 comment](ray-project/ray#67923 (comment)), [#67210 comment](ray-project/ray#67210 (comment)), [#66438 comment](ray-project/ray#66438 (comment)))
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.
Description
on_replica_actor_diedclears the replica set, the cached replica list and the locality sets, but it missesMultiplexMixin._multiplexed_model_id_to_replica_ids. That mapping is only rebuilt inupdate_replicas, so between the router noticing a replica died and the controller broadcasting a new replica set, it still points at a replica that is already gone fromself._replicas.The next request for one of that replica's models picks it anyway and blows up on the lookup in
pow_2_router.py:_fulfill_pending_requestsswallows that, so the routing task just exits and its request is never fulfilled. This drops the dead replica from the mapping too, the same way_discard_colocated_replica_ids_on_replica_actor_diedalready handles the locality sets.Related issues
No existing issue.
Additional information
Tests run.