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: UtilityProcess.fork crash before app ready #41450

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

codebytere
Copy link
Member

Description of Change

Fixes #41396.
Refs #40017

Fixes an issue where calling UtilityProcess.fork prior to the app ready event would cause a crash. This happened because #40017 leveraged SystemNetworkContextManager, which prior to this wasn't created until after the app ready event. This PR updates our SystemNetworkContextManager logic to more closely reflect upstream, where a call to SystemNetworkContextManager::GetInstance() creates a new instance via ElectronBrowserClient::OnNetworkServiceCreated().

Checklist

Release Notes

Notes: Fixed an issue where calling UtilityProcess.fork prior to the app ready event would cause a crash.

@codebytere codebytere added semver/patch backwards-compatible bug fixes target/28-x-y PR should also be added to the "28-x-y" branch. target/29-x-y PR should also be added to the "29-x-y" branch. target/30-x-y PR should also be added to the "30-x-y" branch. labels Feb 27, 2024
@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Feb 27, 2024
@codebytere codebytere changed the title fix: UtilityProcess.fork before app ready fix: UtilityProcess.fork crash before app ready Feb 27, 2024
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.

seems fine to me!

@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Feb 28, 2024
@deepak1556
Copy link
Member

Is the network service fine to be created before IO threads are setup ? We don't allow net module in the main process before app ready for related reasons. I wonder if a better fix would be follow the same pattern in utility process, that is

  1. Throw on net module usage before app ready from utility process scripts
  2. Lazily initialize network context details in the utility process after app is ready.

@github-actions github-actions bot added the target/31-x-y PR should also be added to the "31-x-y" branch. label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/patch backwards-compatible bug fixes target/28-x-y PR should also be added to the "28-x-y" branch. target/29-x-y PR should also be added to the "29-x-y" branch. target/30-x-y PR should also be added to the "30-x-y" branch. target/31-x-y PR should also be added to the "31-x-y" branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: UtilityProcess crashes when using the asar path
3 participants