fix java coreworker crash (#9674)

This commit is contained in:
fangfengbin
2020-07-24 15:36:49 +08:00
committed by GitHub
parent f2705e2c73
commit d4324a4a8f
2 changed files with 10 additions and 5 deletions
+5 -3
View File
@@ -89,9 +89,11 @@ bool ActorManager::AddActorHandle(std::unique_ptr<ActorHandle> actor_handle,
auto actor_notification_callback =
std::bind(&ActorManager::HandleActorStateNotification, this,
std::placeholders::_1, std::placeholders::_2);
RAY_CHECK_OK(gcs_client_->Actors().AsyncSubscribe(
actor_id, actor_notification_callback, nullptr));
{
absl::MutexLock lock(&gcs_client_mutex_);
RAY_CHECK_OK(gcs_client_->Actors().AsyncSubscribe(
actor_id, actor_notification_callback, nullptr));
}
if (!RayConfig::instance().gcs_actor_service_enabled()) {
RAY_CHECK(reference_counter_->SetDeleteCallback(
+5 -2
View File
@@ -132,8 +132,11 @@ class ActorManager {
void HandleActorStateNotification(const ActorID &actor_id,
const gcs::ActorTableData &actor_data);
/// GCS client
std::shared_ptr<gcs::GcsClient> gcs_client_;
/// Mutex to protect the gcs_client_ field.
/// NOTE: Now gcs client is not thread safe, so we add lock protection.
mutable absl::Mutex gcs_client_mutex_;
/// GCS client.
std::shared_ptr<gcs::GcsClient> gcs_client_ GUARDED_BY(gcs_client_mutex_);
/// Interface to submit tasks directly to other actors.
std::shared_ptr<CoreWorkerDirectActorTaskSubmitterInterface> direct_actor_submitter_;