Repository navigation
[Serve] Fix race in test_flapping_rolling_update_stops_consuming_old_replicas - #67163
Merged
Merged
Conversation
Signed-off-by: Jeffrey Wang <[email protected]>
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the test test_flapping_rolling_update_stops_consuming_old_replicas in python/ray/serve/tests/test_deploy_app_2.py. It replaces the local check_deploy_failed helper with a shared _check_terminal_rolling_update function. Additionally, it updates check_settled to query replica details once via _deployment_details(client).replicas instead of making separate queries, preventing race conditions where a replica transitioning from RUNNING to STOPPING might be missed. There are no review comments to address.
jeffreywang88
enabled auto-merge (squash)
October 19, 2026 18:51
qishengxhe
approved these changes
Oct 20, 2026
jeffreywang88
pushed a commit
that referenced
this pull request
Oct 20, 2026
`test_deploy_app_3` (added in #66267) flakes on the HAProxy, gRPC and flaky-tests shards. One commit per cause: - Two waits read replica counts and pids in separate calls, so a replica changing state in between could pass for the state they wait for. They now read one snapshot, as #67163 does for the same race in `test_deploy_app_2`. - The HAProxy shard's 0.01s drain lets a stopping replica close connections HAProxy still uses. The traffic tests whose replicas stop during a rollout now use the 5s drain `test_deploy_app_2` already uses; the gang test is left out, since gang replicas are force-stopped. - Under direct ingress, a request moving from the handle to a replica can briefly count twice, which raised the autoscaling target in `test_surge_rolling_update_follows_autoscaling_mid_rollout`. A 2s upscale delay filters it. - Two waits that ran close to their limit under load get more room. Tested with `pytest python/ray/serve/tests/test_deploy_app_3.py` under the default and HAProxy shard environments with CPU stressors: 13 of 13 in each at the final commit. --------- Signed-off-by: john.taylor <[email protected]> Co-authored-by: Claude <[email protected]>
qishengxhe
pushed a commit
to qishengxhe/ray
that referenced
this pull request
Oct 26, 2026
…7165) `test_deploy_app_3` (added in ray-project#66267) flakes on the HAProxy, gRPC and flaky-tests shards. One commit per cause: - Two waits read replica counts and pids in separate calls, so a replica changing state in between could pass for the state they wait for. They now read one snapshot, as ray-project#67163 does for the same race in `test_deploy_app_2`. - The HAProxy shard's 0.01s drain lets a stopping replica close connections HAProxy still uses. The traffic tests whose replicas stop during a rollout now use the 5s drain `test_deploy_app_2` already uses; the gang test is left out, since gang replicas are force-stopped. - Under direct ingress, a request moving from the handle to a replica can briefly count twice, which raised the autoscaling target in `test_surge_rolling_update_follows_autoscaling_mid_rollout`. A 2s upscale delay filters it. - Two waits that ran close to their limit under load get more room. Tested with `pytest python/ray/serve/tests/test_deploy_app_3.py` under the default and HAProxy shard environments with CPU stressors: 13 of 13 in each at the final commit. --------- Signed-off-by: john.taylor <[email protected]> Co-authored-by: Claude <[email protected]> (cherry picked from commit b2ca380) Signed-off-by: qishengxhe <[email protected]>
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
Fix a race in
test_flapping_rolling_update_stops_consuming_old_replicas: separate state and PID queries could incorrectly declare cleanup complete. Wait for terminal rollout failure and derive both checks from the same replica details.Validated with real actors and HAProxy in Ray and RayTurbo: controlled failure reproduced before the fix; controlled runs and five ordinary repetitions passed afterward in both. Pre-commit passed.
AI assistance was used.
Related issues
Additional information