From b1a7fdac43aee592934df453f0ca6490d8fa8bb7 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 1e1d9434cddb4c..fa778166e9377e 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -260,6 +260,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);