From 8a926982e5202d2a4fb5cf945c71c77f94fe7cd6 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Mon, 11 May 2020 00:55:29 +0200 Subject: [PATCH] worker: call CancelTerminateExecution() before exiting Locker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As the comment indicates, this fixes a DCHECK failure, although I don’t quite understand why it is happening in the first place. PR-URL: https://github.com/nodejs/node/pull/33347 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Benjamin Gruenbaum Reviewed-By: David Carlier --- src/node_worker.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/node_worker.cc b/src/node_worker.cc index 1172dd7e9a8b5e..d184d16ac8ee8b 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -272,6 +272,11 @@ void Worker::Run() { DeleteFnPtr env_; auto cleanup_env = OnScopeLeave([&]() { + // TODO(addaleax): This call is harmless but should not be necessary. + // Figure out why V8 is raising a DCHECK() here without it + // (in test/parallel/test-async-hooks-worker-asyncfn-terminate-4.js). + isolate_->CancelTerminateExecution(); + if (!env_) return; env_->set_can_call_into_js(false); Isolate::DisallowJavascriptExecutionScope disallow_js(isolate_,