-
Notifications
You must be signed in to change notification settings - Fork 7k
[core] Make NotifyGCSRestart RPC Fault Tolerant #57945
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
edoakes
merged 5 commits into
ray-project:master
from
Sparks0219:joshlee/make-notify-gcs-restart-fault-tolerant
Nov 7, 2025
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,7 +69,7 @@ void JobInfoAccessor::AsyncMarkFinished(const JobID &job_id, | |
| }); | ||
| } | ||
|
|
||
| Status JobInfoAccessor::AsyncSubscribeAll( | ||
| void JobInfoAccessor::AsyncSubscribeAll( | ||
| const SubscribeCallback<JobID, rpc::JobTableData> &subscribe, | ||
| const StatusCallback &done) { | ||
| RAY_CHECK(subscribe != nullptr); | ||
|
|
@@ -91,9 +91,9 @@ Status JobInfoAccessor::AsyncSubscribeAll( | |
| /*timeout_ms=*/-1); | ||
| }; | ||
| subscribe_operation_ = [this, subscribe](const StatusCallback &done_callback) { | ||
| return client_impl_->GetGcsSubscriber().SubscribeAllJobs(subscribe, done_callback); | ||
| client_impl_->GetGcsSubscriber().SubscribeAllJobs(subscribe, done_callback); | ||
| }; | ||
| return subscribe_operation_( | ||
| subscribe_operation_( | ||
| [this, done](const Status &status) { fetch_all_data_operation_(done); }); | ||
| } | ||
|
|
||
|
|
@@ -105,9 +105,9 @@ void JobInfoAccessor::AsyncResubscribe() { | |
| }; | ||
|
|
||
| if (subscribe_operation_ != nullptr) { | ||
| RAY_CHECK_OK(subscribe_operation_([this, fetch_all_done](const Status &) { | ||
| subscribe_operation_([this, fetch_all_done](const Status &) { | ||
| fetch_all_data_operation_(fetch_all_done); | ||
| })); | ||
| }); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -391,7 +391,7 @@ void ActorInfoAccessor::AsyncReportActorOutOfScope( | |
| timeout_ms); | ||
| } | ||
|
|
||
| Status ActorInfoAccessor::AsyncSubscribe( | ||
| void ActorInfoAccessor::AsyncSubscribe( | ||
| const ActorID &actor_id, | ||
| const SubscribeCallback<ActorID, rpc::ActorTableData> &subscribe, | ||
| const StatusCallback &done) { | ||
|
|
@@ -418,28 +418,27 @@ Status ActorInfoAccessor::AsyncSubscribe( | |
| absl::MutexLock lock(&mutex_); | ||
| resubscribe_operations_[actor_id] = | ||
| [this, actor_id, subscribe](const StatusCallback &subscribe_done) { | ||
| return client_impl_->GetGcsSubscriber().SubscribeActor( | ||
| client_impl_->GetGcsSubscriber().SubscribeActor( | ||
| actor_id, subscribe, subscribe_done); | ||
| }; | ||
| fetch_data_operations_[actor_id] = fetch_data_operation; | ||
| } | ||
|
|
||
| return client_impl_->GetGcsSubscriber().SubscribeActor( | ||
| client_impl_->GetGcsSubscriber().SubscribeActor( | ||
| actor_id, subscribe, [fetch_data_operation, done](const Status &) { | ||
| fetch_data_operation(done); | ||
| }); | ||
| } | ||
|
|
||
| Status ActorInfoAccessor::AsyncUnsubscribe(const ActorID &actor_id) { | ||
| void ActorInfoAccessor::AsyncUnsubscribe(const ActorID &actor_id) { | ||
| RAY_LOG(DEBUG).WithField(actor_id).WithField(actor_id.JobId()) | ||
| << "Cancelling subscription to an actor"; | ||
| auto status = client_impl_->GetGcsSubscriber().UnsubscribeActor(actor_id); | ||
| client_impl_->GetGcsSubscriber().UnsubscribeActor(actor_id); | ||
| absl::MutexLock lock(&mutex_); | ||
| resubscribe_operations_.erase(actor_id); | ||
| fetch_data_operations_.erase(actor_id); | ||
| RAY_LOG(DEBUG).WithField(actor_id).WithField(actor_id.JobId()) | ||
| << "Finished cancelling subscription to an actor"; | ||
| return status; | ||
| } | ||
|
|
||
| void ActorInfoAccessor::AsyncResubscribe() { | ||
|
|
@@ -449,7 +448,7 @@ void ActorInfoAccessor::AsyncResubscribe() { | |
| // server first, then fetch data from the GCS server. | ||
| absl::MutexLock lock(&mutex_); | ||
| for (auto &[actor_id, resubscribe_op] : resubscribe_operations_) { | ||
| RAY_CHECK_OK(resubscribe_op([this, id = actor_id](const Status &status) { | ||
| resubscribe_op([this, id = actor_id](const Status &status) { | ||
| absl::MutexLock callback_lock(&mutex_); | ||
| auto fetch_data_operation = fetch_data_operations_[id]; | ||
| // `fetch_data_operation` is called in the callback function of subscribe. | ||
|
|
@@ -458,7 +457,7 @@ void ActorInfoAccessor::AsyncResubscribe() { | |
| if (fetch_data_operation != nullptr) { | ||
| fetch_data_operation(nullptr); | ||
| } | ||
| })); | ||
| }); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -939,16 +938,6 @@ void NodeResourceInfoAccessor::AsyncGetDrainingNodes( | |
| }); | ||
| } | ||
|
|
||
| void NodeResourceInfoAccessor::AsyncResubscribe() { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was dead code, we never set these callbacks ever since the subscribe was removed a couple years ago: |
||
| RAY_LOG(DEBUG) << "Reestablishing subscription for node resource info."; | ||
| if (subscribe_resource_operation_ != nullptr) { | ||
| RAY_CHECK_OK(subscribe_resource_operation_(nullptr)); | ||
| } | ||
| if (subscribe_batch_resource_usage_operation_ != nullptr) { | ||
| RAY_CHECK_OK(subscribe_batch_resource_usage_operation_(nullptr)); | ||
| } | ||
| } | ||
|
|
||
| void NodeResourceInfoAccessor::AsyncGetAllResourceUsage( | ||
| const ItemCallback<rpc::ResourceUsageBatchData> &callback) { | ||
| rpc::GetAllResourceUsageRequest request; | ||
|
|
@@ -1013,14 +1002,13 @@ void ErrorInfoAccessor::AsyncReportJobError(rpc::ErrorTableData data) { | |
| WorkerInfoAccessor::WorkerInfoAccessor(GcsClient *client_impl) | ||
| : client_impl_(client_impl) {} | ||
|
|
||
| Status WorkerInfoAccessor::AsyncSubscribeToWorkerFailures( | ||
| void WorkerInfoAccessor::AsyncSubscribeToWorkerFailures( | ||
| const ItemCallback<rpc::WorkerDeltaData> &subscribe, const StatusCallback &done) { | ||
| RAY_CHECK(subscribe != nullptr); | ||
| subscribe_operation_ = [this, subscribe](const StatusCallback &done_callback) { | ||
| return client_impl_->GetGcsSubscriber().SubscribeAllWorkerFailures(subscribe, | ||
| done_callback); | ||
| client_impl_->GetGcsSubscriber().SubscribeAllWorkerFailures(subscribe, done_callback); | ||
| }; | ||
| return subscribe_operation_(done); | ||
| subscribe_operation_(done); | ||
| } | ||
|
|
||
| void WorkerInfoAccessor::AsyncResubscribe() { | ||
|
|
@@ -1029,7 +1017,7 @@ void WorkerInfoAccessor::AsyncResubscribe() { | |
| RAY_LOG(DEBUG) << "Reestablishing subscription for worker failures."; | ||
| // The pub-sub server has restarted, we need to resubscribe to the pub-sub server. | ||
| if (subscribe_operation_ != nullptr) { | ||
| RAY_CHECK_OK(subscribe_operation_(nullptr)); | ||
| subscribe_operation_(nullptr); | ||
| } | ||
| } | ||
|
|
||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be a
RAY_CHECK? IIUC, this gets internally retried so non-OK would only come from raylet reponse (which we don't ever return)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, there's this section of code in the retryable grpc:
ray/src/ray/rpc/retryable_grpc_client.cc
Line 32 in 50ffca4
where all pending requests are flushed with a Status::Disconnected when we receive a node death notification and trigger the dtor for the raylet client. Hence this RAY_CHECK could be easily triggered as long as a NotifyGCSRestart RPC is in flight/pending and we then receive the node death notification for the target node.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^ This is true for all RPCs for the retryable grpc client, we shouldn't use RAY_CHECK in their callbacks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh that's great context. This log message should be improved then:
Specifically, note that it should not be an
ERROR-level log if it's expected behavior.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahhh good point didn't realize that distinction between error/warning logs thanks, done