Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Do not drain worker tasks on main thread
  • Loading branch information
Dominik Inführ authored and aduh95 committed Sep 13, 2024
commit 1bc4970032e934a54ad5ff952811917fb6569dba
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
Comment thread
aduh95 marked this conversation as resolved.
// and v8::Isolate::Dispose will join V8's worker tasks for that isolate.
while (per_isolate->FlushForegroundTasksInternal());
Comment thread
aduh95 marked this conversation as resolved.
Outdated
}

bool PerIsolatePlatformData::FlushForegroundTasksInternal() {
Expand Down