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 authored and aduh95 committed Sep 13, 2024
1 parent b887942 commit 1bc4970
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 @@ -462,10 +462,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 1bc4970

Please sign in to comment.