-
Notifications
You must be signed in to change notification settings - Fork 549
[Test][Autoscaler] deflaky unexpected dead actors in tests by setting max_restarts=-1 #3700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kevin85421
merged 3 commits into
ray-project:master
from
rueian:e2eautoscaler-deflaky-dead-actor
Jun 6, 2025
Merged
[Test][Autoscaler] deflaky unexpected dead actors in tests by setting max_restarts=-1 #3700
kevin85421
merged 3 commits into
ray-project:master
from
rueian:e2eautoscaler-deflaky-dead-actor
Jun 6, 2025
Conversation
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
… max_restarts=-1 Signed-off-by: Rueian <rueiancsie@gmail.com>
4 tasks
… max_restarts=-1 Signed-off-by: Rueian <rueiancsie@gmail.com>
53aec73
to
4024279
Compare
8 tasks
4024279
to
8c8ec66
Compare
rueian
commented
Jun 4, 2025
8c8ec66
to
6322758
Compare
kevin85421
approved these changes
Jun 6, 2025
2 tasks
pawelpaszki
pushed a commit
to opendatahub-io/kuberay
that referenced
this pull request
Jun 10, 2025
Merged
8 tasks
edoakes
pushed a commit
to ray-project/ray
that referenced
this pull request
Jun 13, 2025
…ity (#53782) ## Why are these changes needed? While doing the #53562, we [decided](#53562 (comment)) to refactor the `NodeManager` first to allow us to inject a `WorkerPoolInterface` implementation to it from the `main.cc`. This PR does the refactoring. That is: 1. Updated the `WorkerPoolInterface` to cover all methods of `WorkerPool`. Previously the interface was only a subset. 2. Updated all the existing mock implementations of `WorkerPoolInterface` to cover new missing methods. 3. Replaced `WorkerPool worker_pool_` to `WorkerPoolInterface &worker_pool_` in the `NodeManger` so that we can swap it out for testing, which is required by #53562. 4. Modified the `NodeManager` constructor to accept a `WorkerPoolInterface &worker_pool_`. 5. In addition to the new `WorkerPoolInterface &worker_pool_` injection, we also need to inject all its dependencies. So we ended up with all the following are constructed and owned in the `main.cc`: ```c std::shared_ptr<plasma::PlasmaClient> plasma_client; std::shared_ptr<ray::raylet::NodeManager> node_manager; std::shared_ptr<ray::rpc::ClientCallManager> client_call_manager; std::shared_ptr<ray::rpc::CoreWorkerClientPool> worker_rpc_pool; std::shared_ptr<ray::raylet::WorkerPoolInterface> worker_pool; std::shared_ptr<ray::raylet::LocalObjectManager> local_object_manager; std::shared_ptr<ray::ClusterResourceScheduler> cluster_resource_scheduler; std::shared_ptr<ray::raylet::LocalTaskManager> local_task_manager; std::shared_ptr<ray::raylet::ClusterTaskManagerInterface> cluster_task_manager; std::shared_ptr<ray::pubsub::SubscriberInterface> core_worker_subscriber; std::shared_ptr<ray::IObjectDirectory> object_directory; std::shared_ptr<ray::ObjectManagerInterface> object_manager; std::shared_ptr<ray::raylet::DependencyManager> dependency_manager; absl::flat_hash_map<WorkerID, std::shared_ptr<ray::raylet::WorkerInterface>> leased_workers; ``` This PR does not introduce any behavioral changes. <!-- Please give a short summary of the change and the problem this solves. --> ## Related issue number Related to #53562 #40864 ray-project/kuberay#3701 and ray-project/kuberay#3700 ## Checks - [x] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [x] I've run `scripts/format.sh` to lint the changes in this PR. - [ ] I've included any doc changes needed for https://docs.ray.io/en/master/. - [ ] I've added any new APIs to the API Reference. For example, if I added a method in Tune, I've added it in `doc/source/tune/api/` under the corresponding `.rst` file. - [ ] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/ - Testing Strategy - [ ] Unit tests - [ ] Release tests - [ ] This PR is not tested :( Signed-off-by: Rueian <rueiancsie@gmail.com>
elliot-barn
pushed a commit
to ray-project/ray
that referenced
this pull request
Jun 18, 2025
…ity (#53782) ## Why are these changes needed? While doing the #53562, we [decided](#53562 (comment)) to refactor the `NodeManager` first to allow us to inject a `WorkerPoolInterface` implementation to it from the `main.cc`. This PR does the refactoring. That is: 1. Updated the `WorkerPoolInterface` to cover all methods of `WorkerPool`. Previously the interface was only a subset. 2. Updated all the existing mock implementations of `WorkerPoolInterface` to cover new missing methods. 3. Replaced `WorkerPool worker_pool_` to `WorkerPoolInterface &worker_pool_` in the `NodeManger` so that we can swap it out for testing, which is required by #53562. 4. Modified the `NodeManager` constructor to accept a `WorkerPoolInterface &worker_pool_`. 5. In addition to the new `WorkerPoolInterface &worker_pool_` injection, we also need to inject all its dependencies. So we ended up with all the following are constructed and owned in the `main.cc`: ```c std::shared_ptr<plasma::PlasmaClient> plasma_client; std::shared_ptr<ray::raylet::NodeManager> node_manager; std::shared_ptr<ray::rpc::ClientCallManager> client_call_manager; std::shared_ptr<ray::rpc::CoreWorkerClientPool> worker_rpc_pool; std::shared_ptr<ray::raylet::WorkerPoolInterface> worker_pool; std::shared_ptr<ray::raylet::LocalObjectManager> local_object_manager; std::shared_ptr<ray::ClusterResourceScheduler> cluster_resource_scheduler; std::shared_ptr<ray::raylet::LocalTaskManager> local_task_manager; std::shared_ptr<ray::raylet::ClusterTaskManagerInterface> cluster_task_manager; std::shared_ptr<ray::pubsub::SubscriberInterface> core_worker_subscriber; std::shared_ptr<ray::IObjectDirectory> object_directory; std::shared_ptr<ray::ObjectManagerInterface> object_manager; std::shared_ptr<ray::raylet::DependencyManager> dependency_manager; absl::flat_hash_map<WorkerID, std::shared_ptr<ray::raylet::WorkerInterface>> leased_workers; ``` This PR does not introduce any behavioral changes. <!-- Please give a short summary of the change and the problem this solves. --> ## Related issue number Related to #53562 #40864 ray-project/kuberay#3701 and ray-project/kuberay#3700 ## Checks - [x] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [x] I've run `scripts/format.sh` to lint the changes in this PR. - [ ] I've included any doc changes needed for https://docs.ray.io/en/master/. - [ ] I've added any new APIs to the API Reference. For example, if I added a method in Tune, I've added it in `doc/source/tune/api/` under the corresponding `.rst` file. - [ ] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/ - Testing Strategy - [ ] Unit tests - [ ] Release tests - [ ] This PR is not tested :( Signed-off-by: Rueian <rueiancsie@gmail.com> Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
rebel-scottlee
pushed a commit
to rebellions-sw/ray
that referenced
this pull request
Jun 21, 2025
…ity (ray-project#53782) ## Why are these changes needed? While doing the ray-project#53562, we [decided]( 9E88 ray-project#53562 (comment)) to refactor the `NodeManager` first to allow us to inject a `WorkerPoolInterface` implementation to it from the `main.cc`. This PR does the refactoring. That is: 1. Updated the `WorkerPoolInterface` to cover all methods of `WorkerPool`. Previously the interface was only a subset. 2. Updated all the existing mock implementations of `WorkerPoolInterface` to cover new missing methods. 3. Replaced `WorkerPool worker_pool_` to `WorkerPoolInterface &worker_pool_` in the `NodeManger` so that we can swap it out for testing, which is required by ray-project#53562. 4. Modified the `NodeManager` constructor to accept a `WorkerPoolInterface &worker_pool_`. 5. In addition to the new `WorkerPoolInterface &worker_pool_` injection, we also need to inject all its dependencies. So we ended up with all the following are constructed and owned in the `main.cc`: ```c std::shared_ptr<plasma::PlasmaClient> plasma_client; std::shared_ptr<ray::raylet::NodeManager> node_manager; std::shared_ptr<ray::rpc::ClientCallManager> client_call_manager; std::shared_ptr<ray::rpc::CoreWorkerClientPool> worker_rpc_pool; std::shared_ptr<ray::raylet::WorkerPoolInterface> worker_pool; std::shared_ptr<ray::raylet::LocalObjectManager> local_object_manager; std::shared_ptr<ray::ClusterResourceScheduler> cluster_resource_scheduler; std::shared_ptr<ray::raylet::LocalTaskManager> local_task_manager; std::shared_ptr<ray::raylet::ClusterTaskManagerInterface> cluster_task_manager; std::shared_ptr<ray::pubsub::SubscriberInterface> core_worker_subscriber; std::shared_ptr<ray::IObjectDirectory> object_directory; std::shared_ptr<ray::ObjectManagerInterface> object_manager; std::shared_ptr<ray::raylet::DependencyManager> dependency_manager; absl::flat_hash_map<WorkerID, std::shared_ptr<ray::raylet::WorkerInterface>> leased_workers; ``` This PR does not introduce any behavioral changes. <!-- Please give a short summary of the change and the problem this solves. --> ## Related issue number Related to ray-project#53562 ray-project#40864 ray-project/kuberay#3701 and ray-project/kuberay#3700 ## Checks - [x] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [x] I've run `scripts/format.sh` to lint the changes in this PR. - [ ] I've included any doc changes needed for https://docs.ray.io/en/master/. - [ ] I've added any new APIs to the API Reference. For example, if I added a method in Tune, I've added it in `doc/source/tune/api/` under the corresponding `.rst` file. - [ ] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/ - Testing Strategy - [ ] Unit tests - [ ] Release tests - [ ] This PR is not tested :( Signed-off-by: Rueian <rueiancsie@gmail.com> Signed-off-by: Scott Lee <scott.lee@rebellions.ai>
edoakes
pushed a commit
to ray-project/ray
that referenced
this pull request
Jun 24, 2025
By replacing the inaccurate `worker->IsDetachedActor()` with `worker->GetAssignedTask().GetTaskSpecification().IsDetachedActor()`. In the previous PR #14184, the `worker.MarkDetachedActor()` that happened on assigning a task to a worker was [deleted](https://github.com/ray-project/ray/pull/14184/files#diff-d2f22b8f1bf5f9be47dacae8b467a72ee94629df12ffcc18b13447192ff3dbcfL1982). <img width="496" alt="image" src="https://github.com/user-attachments/assets/9510a564-909a-44cd-aa19-2d85fccaadd7" /> And that causes a leased worker for a detached worker can be killed by [HandleUnexpectedWorkerFailure](https://github.com/ray-project/ray/blob/f5c59745d00982835feb145d14d1f9e0d4b0db6c/src/ray/raylet/node_manager.cc#L1059), as mentioned in #40864, which is also even triggered by a normal exit of driver. The reproducible scripts can be found in [the comment](#40864 (comment)). I think actually `Worker::IsDetachedActor` and `Worker::MarkDetachedActor` are redundant and better be removed because we can access the info of whether the worker is detached or not through its assigned task. The info is first ready after `worker->SetAssignedTask(task)`(L962) during `LocalTaskManager::Dispatch` and then the worker is inserted into the `leased_workers` map (L972). https://github.com/ray-project/ray/blob/118c37058ae2904a79da9be160633a6a8d3ee3b6/src/ray/raylet/local_task_manager.cc#L962-L972 Therefore, we can access the info through `worker->GetAssignedTask().GetTaskSpecification().IsDetachedActor()` safely while looping over the `leased_workers_` in the `NodeManager`. By doing that, we don't need to worry about we could miss `worker.MarkDetachedActor()` sometimes. Closes #40864 Related to ray-project/kuberay#3701 and ray-project/kuberay#3700 --------- Signed-off-by: Rueian <rueiancsie@gmail.com>
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.
Why are these changes needed?
Sometimes the autoscaler e2e test could fail like this

I found that was because some actors died unexpectedly. For example, we should have 2 active and 1 pending actor here, but we got 1 dead already, which was unexpected:


actor logs:
autoscaler logs
This PR tries to restart actors by setting
max_restarts=-1
.Related issue number
Closes #3701
Related to ray-project/ray#40864
Checks