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][CoreWorker] fix data race during exiting #18902

Merged
merged 1 commit into from
Sep 27, 2021

Conversation

scv119
Copy link
Contributor

@scv119 scv119 commented Sep 26, 2021

exiting_ is being accessed by multiple threads; it should be atomic to be thread safe.

},
// We need to kill it regardless if the RPC failed.
[this]() { Exit(rpc::WorkerExitType::INTENDED_EXIT); });
send_reply_callback(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

clang-formatted

@scv119 scv119 linked an issue Sep 26, 2021 that may be closed by this pull request
2 tasks
@@ -1409,7 +1409,8 @@ class CoreWorker : public rpc::CoreWorkerServiceHandler {
ObjectID object_id, void *py_future);

/// Whether we are shutting down and not running further tasks.
bool exiting_ = false;
/// Being accessed by grpc thread and task_execution_service_ thread.
std::atomic<bool> exiting_;
Copy link
Member

Choose a reason for hiding this comment

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

Good to comment on the behavior.

Btw, why not keep setting its default value?

Does it matter to call exiting_.load(std::memory_order_relaxed) when it is read?

@scv119 scv119 merged commit cbd7dc7 into ray-project:master Sep 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Core] CoreWorker crash due to destruction order
5 participants