Skip to content
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

[Core] Fix the race condition where grpc requests are handled while core worker not yet initialized #37117

Merged
merged 11 commits into from
Jul 11, 2023

Conversation

scv119
Copy link
Contributor

@scv119 scv119 commented Jul 5, 2023

Why are these changes needed?

there is a race condition where grpc server start handling requests before the core worker is initialized. This PR fixes by waiting for initialization before handling any grpc request.

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • 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 :(

@scv119 scv119 linked an issue Jul 5, 2023 that may be closed by this pull request
@scv119 scv119 marked this pull request as ready for review July 5, 2023 20:43
Copy link
Contributor

@rkooo567 rkooo567 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be the best if we can fix by changing the initialization order as @jjyao said. But if not, I have comments for existing logics;

src/ray/core_worker/core_worker.cc Outdated Show resolved Hide resolved
src/ray/core_worker/core_worker.cc Outdated Show resolved Hide resolved
src/ray/core_worker/core_worker.cc Outdated Show resolved Hide resolved
@scv119 scv119 added the do-not-merge Do not merge this PR! label Jul 6, 2023
@scv119
Copy link
Contributor Author

scv119 commented Jul 6, 2023

yes it's from GCS, let me defer that instead.

@scv119
Copy link
Contributor Author

scv119 commented Jul 6, 2023

huh none of them seems easy. we should process with this.

@scv119 scv119 removed the do-not-merge Do not merge this PR! label Jul 6, 2023
@fishbone
Copy link
Contributor

fishbone commented Jul 6, 2023

I'm OK with the solution but preferred with the other way like fixing the initialization. I'll leave it to @jjyao @rkooo567

Copy link
Contributor

@rkooo567 rkooo567 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me!

@scv119 scv119 added the do-not-merge Do not merge this PR! label Jul 9, 2023
@@ -196,6 +209,9 @@ class ServerCallImpl : public ServerCall {
}

void HandleRequestImpl() {
if constexpr (std::is_base_of_v<DelayedServiceHandler, ServiceHandler>) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C++ is amazing

@scv119 scv119 merged commit 5e8fd37 into ray-project:master Jul 11, 2023
scv119 added a commit to scv119/ray that referenced this pull request Jul 11, 2023
…ore worker not yet initialized (ray-project#37117)

Why are these changes needed?
there is a race condition where grpc server start handling requests before the core worker is initialized. This PR fixes by waiting for initialization before handling any grpc request.
scv119 added a commit that referenced this pull request Jul 11, 2023
#37301)

* [Core] Fix the race condition where grpc requests are handled while core worker not yet initialized (#37117)

Why are these changes needed?
there is a race condition where grpc server start handling requests before the core worker is initialized. This PR fixes by waiting for initialization before handling any grpc request.

* update
scv119 added a commit that referenced this pull request Jul 12, 2023
… while core worker not yet initialized (#37117)"

This reverts commit 5e8fd37.
scv119 added a commit that referenced this pull request Jul 12, 2023
… while core worker not yet initialized (#37117)" (#37343)

This reverts commit 5e8fd37.
scv119 added a commit to scv119/ray that referenced this pull request Jul 12, 2023
… handled while core worker not yet initialized (ray-project#37117)" (ray-project#37343)"

This reverts commit 59a15fc.
rkooo567 added a commit to rkooo567/ray that referenced this pull request Jul 18, 2023
… handled while core worker not yet initialized (ray-project#37117)" (ray-project#37343)"

This reverts commit 59a15fc.
scv119 pushed a commit that referenced this pull request Jul 18, 2023
… handled while core worker not yet initialized (#37117)" (#37343)" (#37495)

This reverts commit 59a15fc.
Bhav00 pushed a commit to Bhav00/ray that referenced this pull request Jul 28, 2023
Bhav00 pushed a commit to Bhav00/ray that referenced this pull request Jul 28, 2023
NripeshN pushed a commit to NripeshN/ray that referenced this pull request Aug 15, 2023
…ore worker not yet initialized (ray-project#37117)

Why are these changes needed?
there is a race condition where grpc server start handling requests before the core worker is initialized. This PR fixes by waiting for initialization before handling any grpc request.

Signed-off-by: NripeshN <nn2012@hw.ac.uk>
NripeshN pushed a commit to NripeshN/ray that referenced this pull request Aug 15, 2023
… while core worker not yet initialized (ray-project#37117)" (ray-project#37343)

This reverts commit 5e8fd37.

Signed-off-by: NripeshN <nn2012@hw.ac.uk>
NripeshN pushed a commit to NripeshN/ray that referenced this pull request Aug 15, 2023
… handled while core worker not yet initialized (ray-project#37117)" (ray-project#37343)" (ray-project#37495)

This reverts commit 59a15fc.

Signed-off-by: NripeshN <nn2012@hw.ac.uk>
arvind-chandra pushed a commit to lmco/ray that referenced this pull request Aug 31, 2023
…ore worker not yet initialized (ray-project#37117)

Why are these changes needed?
there is a race condition where grpc server start handling requests before the core worker is initialized. This PR fixes by waiting for initialization before handling any grpc request.

Signed-off-by: e428265 <arvind.chandramouli@lmco.com>
arvind-chandra pushed a commit to lmco/ray that referenced this pull request Aug 31, 2023
… while core worker not yet initialized (ray-project#37117)" (ray-project#37343)

This reverts commit 5e8fd37.

Signed-off-by: e428265 <arvind.chandramouli@lmco.com>
arvind-chandra pushed a commit to lmco/ray that referenced this pull request Aug 31, 2023
… handled while core worker not yet initialized (ray-project#37117)" (ray-project#37343)" (ray-project#37495)

This reverts commit 59a15fc.

Signed-off-by: e428265 <arvind.chandramouli@lmco.com>
vymao pushed a commit to vymao/ray that referenced this pull request Oct 11, 2023
… handled while core worker not yet initialized (ray-project#37117)" (ray-project#37343)" (ray-project#37495)

This reverts commit 59a15fc.

Signed-off-by: Victor <vctr.y.m@example.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge Do not merge this PR!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[release-test] placement_group_performance_test.aws failed
4 participants