fix: add SafeForTerminationScopes for SIGINT interruptions (#26933)

This commit is contained in:
Shelley Vohr 2020-12-11 15:03:41 -08:00 committed by GitHub
parent 44ca6e0818
commit 2f9281519c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 1 deletions

View file

@ -30,3 +30,4 @@ fix_add_v8_enable_reverse_jsargs_defines_in_common_gypi.patch
fix_allow_preventing_initializeinspector_in_env.patch
src_allow_embedders_to_provide_a_custom_pageallocator_to.patch
allow_preventing_preparestacktracecallback.patch
fix_add_safeforterminationscopes_for_sigint_interruptions.patch

View file

@ -0,0 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Thu, 10 Dec 2020 14:39:33 -0800
Subject: fix: add SafeForTerminationScopes for SIGINT interruptions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
We start Node.js with only_terminate_in_safe_scope set to true becuase
it's set by gins IsolateHolder. In those cases, parts of the API that
expect execution termination to happen need to be marked as able to
receive those events.
Upstreamed at https://github.com/nodejs/node/pull/36344.
diff --git a/src/module_wrap.cc b/src/module_wrap.cc
index f778b089dc4009912361342077793e7918286de3..9302fa6f68d83717a02b82891466ce12b6af2cfd 100644
--- a/src/module_wrap.cc
+++ b/src/module_wrap.cc
@@ -350,6 +350,7 @@ void ModuleWrap::Evaluate(const FunctionCallbackInfo<Value>& args) {
ShouldNotAbortOnUncaughtScope no_abort_scope(env);
TryCatchScope try_catch(env);
+ Isolate::SafeForTerminationScope safe_for_termination(env->isolate());
bool timed_out = false;
bool received_signal = false;
diff --git a/src/node_contextify.cc b/src/node_contextify.cc
index 848e883a829a9725649d837bff09b30156f4f661..a69570400cd897699b1033102767b3389ff8ef38 100644
--- a/src/node_contextify.cc
+++ b/src/node_contextify.cc
@@ -933,6 +933,7 @@ bool ContextifyScript::EvalMachine(Environment* env,
return false;
}
TryCatchScope try_catch(env);
+ Isolate::SafeForTerminationScope safe_for_termination(env->isolate());
ContextifyScript* wrapped_script;
ASSIGN_OR_RETURN_UNWRAP(&wrapped_script, args.Holder(), false);
Local<UnboundScript> unbound_script =

View file

@ -146,7 +146,6 @@
"parallel/test-v8-flags",
"parallel/test-vm-module-basic",
"parallel/test-vm-parse-abort-on-uncaught-exception",
"parallel/test-vm-sigint",
"parallel/test-vm-sigint-existing-handler",
"parallel/test-vm-timeout",
"parallel/test-whatwg-encoding-custom-textdecoder",