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-05-16 12:43:55 -07:00
1 parent 2dc5db8c07
commit b1a7fdac43
1 file changed
+5
+5
View File
@@ -260,6 +260,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);