Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: allow optional Isolate termination in node::Stop() #46583

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

codebytere
Copy link
Member

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.

@nodejs-github-bot
Copy link
Contributor

Review requested:

  • @nodejs/startup

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Feb 9, 2023
@codebytere codebytere changed the title src: allow optional isolation termination in node::Stop() src: allow optional Isolate termination in node::Stop() Feb 9, 2023
@addaleax addaleax added the semver-major PRs that contain breaking changes and should be released in the next major version. label Feb 9, 2023
@addaleax
Copy link
Member

addaleax commented Feb 9, 2023

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.

That’s what I would have suggested for this use case before reading to the end of the PR description 🙂 But no strong feelings here, if this makes your life easier then I don’t see any issues with it :)

src/node.h Outdated Show resolved Hide resolved
@codebytere codebytere force-pushed the optional-isolate-termination branch 2 times, most recently from 2be2d9b to 7a99e13 Compare February 10, 2023 09:08
src/node.h Outdated Show resolved Hide resolved
src/node.h Outdated Show resolved Hide resolved
@addaleax addaleax added semver-minor PRs that contain new features and should be released in the next minor version. and removed semver-major PRs that contain breaking changes and should be released in the next major version. labels Feb 10, 2023
@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Feb 12, 2023
@codebytere codebytere force-pushed the optional-isolate-termination branch 2 times, most recently from 72f0094 to f50bf1d Compare February 13, 2023 14:18
@codebytere codebytere added request-ci Add this label to start a Jenkins CI on a PR. and removed request-ci Add this label to start a Jenkins CI on a PR. labels Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. semver-minor PRs that contain new features and should be released in the next minor version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants