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

chore: stop leaking v8 environment in main process #22761

Merged
merged 1 commit into from
Mar 20, 2020
Merged

Conversation

nornagon
Copy link
Member

Description of Change

This changes our shutdown procedure to include cleaning up the v8 Isolate. The bug referenced in the comment appears to no longer be an issue.

Two things broke when I made this change, both discovered via ASan:

  1. Browser was being destroyed after the Isolate, which meant it was attempting to clean up its Global handles, but v8 had already cleaned them up.
  2. There were some global variables of type v8::Global, which were crashing on shutdown because their destructors were being called during C++'s finalization stage. I've switched those globals to base::NoDestructor to prevent those destructors from being called. They might be better stored in gin::PerIsolateData or on some other object with a more clearly defined lifetime. However, at present we only ever have a single v8 isolate in the main process, so that problem can be solved another time.

Checklist

  • PR description included and stakeholders cc'd
  • npm test passes
  • PR title follows semantic commit guidelines

Release Notes

Notes: none

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Mar 19, 2020
Copy link
Member

@deepak1556 deepak1556 left a comment

Choose a reason for hiding this comment

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

Nice 💯

@nornagon nornagon changed the title chore: stop leaking v8 environment chore: stop leaking v8 environment in main process Mar 19, 2020
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Mar 20, 2020
@nornagon nornagon merged commit 07a049e into master Mar 20, 2020
@release-clerk
Copy link

release-clerk bot commented Mar 20, 2020

No Release Notes

@nornagon nornagon deleted the dont-leak-jsenv branch March 20, 2020 21:16
sentialx pushed a commit to sentialx/electron that referenced this pull request Apr 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants