From d674a6883c04d43fd9132ecaa55745098f6499d5 Mon Sep 17 00:00:00 2001 From: Stephen Belanger Date: Thu, 30 Jan 2025 20:08:56 +0800 Subject: [PATCH] src: fix platform shutdown deadlock Each worker is signalling its own completion of tasks independently and so should only be signalling for one corresponding drain otherwise the count of outstanding tasks goes out of sync and the process will never stop waiting for tasks when it should be exiting. It just needs to be calling Signal rather than Broadcast. --- src/node_platform.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_platform.cc b/src/node_platform.cc index 632217b088ee52..f1114ef744e601 100644 --- a/src/node_platform.cc +++ b/src/node_platform.cc @@ -629,7 +629,7 @@ template void TaskQueue::NotifyOfCompletion() { Mutex::ScopedLock scoped_lock(lock_); if (--outstanding_tasks_ == 0) { - tasks_drained_.Broadcast(scoped_lock); + tasks_drained_.Signal(scoped_lock); } }