Skip to content

src: allow optional Isolate termination in `node::Stop()`

This patch allows for node::Stop() to conditionally call v8:Isolate::TerminateExecution().

In several cases, we do not want to invoke a termination exception at exit when we're running with only_terminate_in_safe_scope set to false. Heap and coverage profilers run after environment exit and if there is a pending exception at this stage then they will fail to generate the appropriate profiles. This happens because V8's JSON logic, used by profilers here, expects that there are no pending exceptions. Node.js does not call node::Stop() on teardown and therefore does not have this issue when also running with only_terminate_in_safe_scope set to false (this is the default). Before this change, we were working around the problem by calling env->isolate()->CancelTerminateExecution(), but it would be preferable to be able to specify it here.

Merge request reports

Loading