diff --git a/src/node_platform.cc b/src/node_platform.cc index 74ab4a3df8f09b1..7d1113df4971011 100644 --- a/src/node_platform.cc +++ b/src/node_platform.cc @@ -451,10 +451,9 @@ void NodePlatform::DrainTasks(Isolate* isolate) { std::shared_ptr per_isolate = ForNodeIsolate(isolate); if (!per_isolate) return; - do { - // Worker tasks aren't associated with an Isolate. - worker_thread_task_runner_->BlockingDrain(); - } while (per_isolate->FlushForegroundTasksInternal()); + // Drain foreground tasks but not worker tasks as this may cause deadlocks + // and v8::Isolate::Dispose will join V8's worker tasks for that isolate. + while (per_isolate->FlushForegroundTasksInternal()); } bool PerIsolatePlatformData::FlushForegroundTasksInternal() {