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

fix: avoid using v8 on Isolate termination #35766

Merged
merged 3 commits into from Feb 9, 2023
Merged

Conversation

codebytere
Copy link
Member

@codebytere codebytere commented Sep 22, 2022

Description of Change

Removes our patches disabling the Chromium check added in CL:3620285.

We also set only_terminate_in_safe_scope to false in v8::Isolate::CreateParams - gin enables it by default but Node.js does not. This can cause crashes owing to Node.js' unique usage of nested microtasks and possible termination. We disable this to align more closely with Node.js and leave it enabled in the renderer and browser processes.

Checklist

Release Notes

Notes: none

@codebytere codebytere added semver/patch backwards-compatible bug fixes target/21-x-y PR should also be added to the "21-x-y" branch. labels Sep 22, 2022
@codebytere codebytere requested review from a team as code owners September 22, 2022 10:07
@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Sep 22, 2022
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Sep 23, 2022
@codebytere codebytere requested a review from a team as a code owner September 27, 2022 12:00
@jkleinsc jkleinsc added the target/22-x-y PR should also be added to the "22-x-y" branch. label Sep 28, 2022
@codebytere codebytere force-pushed the pick-terminating-fix branch 2 times, most recently from 34cf623 to 7ca3d50 Compare October 4, 2022 13:35
shell/app/node_main.cc Outdated Show resolved Hide resolved
@electron electron deleted a comment from codebytere Oct 4, 2022
@ckerr
Copy link
Member

ckerr commented Oct 4, 2022

ckerr deleted a comment from codebytere 7 minutes ago

I was cleaning my review comment and it went off 🔫

shell/app/node_main.cc Outdated Show resolved Hide resolved
Copy link
Member

@RaisinTen RaisinTen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM if CI passes 👍

shell/browser/javascript_environment.cc Outdated Show resolved Hide resolved
shell/browser/javascript_environment.h Outdated Show resolved Hide resolved
shell/browser/javascript_environment.h Outdated Show resolved Hide resolved
shell/browser/javascript_environment.h Show resolved Hide resolved
Copy link
Member

@ckerr ckerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diff LGTM.

linux-x64-testing-node has a few failures. DYK if these are relevant or if they're flakes?

Copy link
Member

@nornagon nornagon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code lgtm, though setting only_terminate_in_safe_scope = false would seem to suggest that in node mode we are okay to terminate in an unsafe scope...? what are the implications of that?
https://source.chromium.org/chromium/chromium/src/+/main:v8/include/v8-isolate.h;l=279-282;drc=cc40beb19a2be3cf1840576b75be5ebbd818c66d

also, do we need to do this for unsandboxed renderers too?

@codebytere
Copy link
Member Author

codebytere commented Oct 5, 2022

@nornagon i'd say we don't need to do this for unsandboxed renderers, since imo we should be staying in alignment with gin defaults for all other processes.

Part of the reason we're doing this in this PR is because Node.js uses nested microtasks to handle certain operations in a way that Chromium never does - I've already commented upstream (to Node.js) about this in terms of whether it's something that can be fixed there.

@zcbenz
Copy link
Member

zcbenz commented Oct 6, 2022

The linux-x64-testing-node CI failure does not disappear after a few reruns.

@codebytere codebytere merged commit 478ce96 into main Feb 9, 2023
5 checks passed
@codebytere codebytere deleted the pick-terminating-fix branch February 9, 2023 08:48
@release-clerk
Copy link

release-clerk bot commented Feb 9, 2023

No Release Notes

@trop
Copy link
Contributor

trop bot commented Feb 9, 2023

I was unable to backport this PR to "22-x-y" cleanly;
you will need to perform this backport manually.

@trop
Copy link
Contributor

trop bot commented Feb 9, 2023

I was unable to backport this PR to "21-x-y" cleanly;
you will need to perform this backport manually.

@trop trop bot added needs-manual-bp/22-x-y and removed target/22-x-y PR should also be added to the "22-x-y" branch. target/21-x-y PR should also be added to the "21-x-y" branch. labels Feb 9, 2023
@trop
Copy link
Contributor

trop bot commented Feb 9, 2023

I was unable to backport this PR to "23-x-y" cleanly;
you will need to perform this backport manually.

@trop trop bot added needs-manual-bp/21-x-y needs-manual-bp/23-x-y and removed target/23-x-y PR should also be added to the "23-x-y" branch. labels Feb 9, 2023
khalwa pushed a commit to solarwindscloud/electron that referenced this pull request Feb 22, 2023
* fix: avoid using v8 on Isolate termination

* chore: refactor for review

---------

Co-authored-by: electron-patch-conflict-fixer[bot] <83340002+electron-patch-conflict-fixer[bot]@users.noreply.github.com>
gecko19 pushed a commit to brightsign/electron that referenced this pull request Feb 28, 2023
* fix: avoid using v8 on Isolate termination

* chore: refactor for review

---------

Co-authored-by: electron-patch-conflict-fixer[bot] <83340002+electron-patch-conflict-fixer[bot]@users.noreply.github.com>
@trop
Copy link
Contributor

trop bot commented Apr 17, 2023

@codebytere has manually backported this PR to "23-x-y", please check out #38000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged/23-x-y PR was merged to the "23-x-y" branch. semver/patch backwards-compatible bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants