From 0731b039627db1fb26a84b12b00e1cf890ec4106 Mon Sep 17 00:00:00 2001 From: chezhang Date: Mon, 27 Jul 2020 16:43:56 +0800 Subject: [PATCH] Fix a bug that heartbeat thread may be stuck due to deadlock --- nodemanager/Version.h | 1 + nodemanager/core/RemoteExecutor.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/nodemanager/Version.h b/nodemanager/Version.h index 8176a33..f344970 100644 --- a/nodemanager/Version.h +++ b/nodemanager/Version.h @@ -641,6 +641,7 @@ namespace hpc { "2.5.0.0", { "Update building environment (from cpprest2.8 on ubuntu1404 with system gnu libs to cpprest2.10 on ubuntu1804) to fix memory leak issue", + "Fix a bug that heartbeat thread may be stuck due to deadlock", } }, }; diff --git a/nodemanager/core/RemoteExecutor.cpp b/nodemanager/core/RemoteExecutor.cpp index 8e85804..bc911d9 100644 --- a/nodemanager/core/RemoteExecutor.cpp +++ b/nodemanager/core/RemoteExecutor.cpp @@ -617,7 +617,7 @@ void RemoteExecutor::StartHeartbeat() void RemoteExecutor::UpdateStatistics() { - Logger::Debug(0, 0, 0, "Updating tasks' statistics."); + Logger::Info("Update tasks' statistics."); auto* table = JobTaskTable::GetInstance(); if (table != nullptr) @@ -625,6 +625,7 @@ void RemoteExecutor::UpdateStatistics() auto tasks = table->GetAllTasks(); for (const auto& taskInfo : tasks) { + ReaderLock readerLock(&this->lock); auto p = this->processes.find(taskInfo->ProcessKey); if (p != this->processes.end()) {