Fix a bug that heartbeat thread may be stuck due to deadlock

This commit is contained in:
chezhang 2020-07-27 16:43:56 +08:00
Родитель 6130db6eb7
Коммит 0731b03962
2 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -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",
}
},
};

Просмотреть файл

@ -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())
{