From 5e5bf0c236eaea58b59e9ee0984b4630a716bfe8 Mon Sep 17 00:00:00 2001 From: Santiago Gimeno Date: Thu, 17 Nov 2022 21:41:04 +0100 Subject: [PATCH] src: don't run tasks on isolate termination Fixes: https://github.com/nodejs/node/issues/45419 PR-URL: https://github.com/nodejs/node/pull/45444 Reviewed-By: Ben Noordhuis Reviewed-By: Rich Trott Reviewed-By: James M Snell Reviewed-By: Luigi Pinca --- src/node_platform.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_platform.cc b/src/node_platform.cc index 6085c9487b6bf9..960583390318ca 100644 --- a/src/node_platform.cc +++ b/src/node_platform.cc @@ -406,7 +406,7 @@ int NodePlatform::NumberOfWorkerThreads() { } void PerIsolatePlatformData::RunForegroundTask(std::unique_ptr task) { - if (isolate_->IsExecutionTerminating()) return task->Run(); + if (isolate_->IsExecutionTerminating()) return; DebugSealHandleScope scope(isolate_); Environment* env = Environment::GetCurrent(isolate_); if (env != nullptr) {