Skip to content

Commit 1bc4970

Browse files
Dominik Inführaduh95
Dominik Inführ
authored andcommitted
Do not drain worker tasks on main thread
1 parent b887942 commit 1bc4970

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/node_platform.cc

+3-4
Original file line numberDiff line numberDiff line change
@@ -462,10 +462,9 @@ void NodePlatform::DrainTasks(Isolate* isolate) {
462462
std::shared_ptr<PerIsolatePlatformData> per_isolate = ForNodeIsolate(isolate);
463463
if (!per_isolate) return;
464464

465-
do {
466-
// Worker tasks aren't associated with an Isolate.
467-
worker_thread_task_runner_->BlockingDrain();
468-
} while (per_isolate->FlushForegroundTasksInternal());
465+
// Drain foreground tasks but not worker tasks as this may cause deadlocks
466+
// and v8::Isolate::Dispose will join V8's worker tasks for that isolate.
467+
while (per_isolate->FlushForegroundTasksInternal());
469468
}
470469

471470
bool PerIsolatePlatformData::FlushForegroundTasksInternal() {

0 commit comments

Comments
 (0)