worker: call CancelTerminateExecution() before exiting Locker

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 <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
This commit is contained in:
Anna Henningsen authored and Shelley Vohr committed 2020-06-08 19:32:24 -07:00
1 parent c129e8809e
commit 8a926982e5
1 file changed
+5
+5
View File
@@ -272,6 +272,11 @@ void Worker::Run() {
DeleteFnPtr<Environment, FreeEnvironment> 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_,