Skip to content

Commit

Permalink
Do not drain worker tasks on main thread
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik Inführ committed Apr 6, 2023
1 parent 0e79635 commit 14b1a3e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/node_platform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,9 @@ void NodePlatform::DrainTasks(Isolate* isolate) {
std::shared_ptr<PerIsolatePlatformData> 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() {
Expand Down

0 comments on commit 14b1a3e

Please sign in to comment.