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: handle a race condition between preload scripts executing and navigations #17577

Merged
merged 1 commit into from Mar 28, 2019

Conversation

MarshallOfSound
Copy link
Member

There is a race condition between DidCreateScriptContext and another navigation occuring in the main process. If the navigation occurs while the preload script is running, the same process is re-used. This ensures that any pending navigations are completely removed / ignored when we trigger a new navigation.

Refs #17576

Please note that although this refs #17576 it does not completely fix that issue, it makes it way harder to occur but it could still occur. This is the quick fix, I'll be following up with another patch later to fix this / patch over this in the NavigationController impl in Chromium.

Release Notes

Notes: Fixed issue where preload scripts would sometimes run twice in the same process in different contexts resulting in broken native node module loading.

navigations

There is a race condition between DidCreateScriptContext and another
navigation occuring in the main process. If the navigation occurs while
the preload script is running, the same process is re-used.  This
ensures that any pending navigations are completely removed / ignored
when we trigger a new navigation.

Fixes #17576
@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Mar 27, 2019
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.

This patch seems fine, since we already expect to discard non committed entries through params.should_clear_history_list , the race condition described in this PR might be why that isn't achieved. Having an explicit call, looks good.

@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Mar 28, 2019
@MarshallOfSound MarshallOfSound merged commit 3475cd1 into master Mar 28, 2019
@release-clerk
Copy link

release-clerk bot commented Mar 28, 2019

Release Notes Persisted

Fixed issue where preload scripts would sometimes run twice in the same process in different contexts resulting in broken native node module loading.

@trop
Copy link
Contributor

trop bot commented Mar 28, 2019

I have automatically backported this PR to "3-1-x", please check out #17595

@trop
Copy link
Contributor

trop bot commented Mar 28, 2019

I have automatically backported this PR to "4-1-x", please check out #17596

@trop
Copy link
Contributor

trop bot commented Mar 28, 2019

I have automatically backported this PR to "5-0-x", please check out #17597

@sofianguy sofianguy added this to Fixed in 3.1.8 in 3.1.x Mar 29, 2019
@sofianguy sofianguy added this to Fixed in 5.0.0-beta.8 in 5.0.x Apr 4, 2019
@sofianguy sofianguy added this to Fixed (3.1.8) in 3.0.x / 3.1.x May 1, 2019
kiku-jw pushed a commit to kiku-jw/electron that referenced this pull request May 16, 2019
…lectron#17577)

navigations

There is a race condition between DidCreateScriptContext and another
navigation occuring in the main process. If the navigation occurs while
the preload script is running, the same process is re-used.  This
ensures that any pending navigations are completely removed / ignored
when we trigger a new navigation.

Fixes electron#17576
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
3.0.x / 3.1.x
Fixed (3.1.8)
3.1.x
Fixed in 3.1.8
5.0.x
Fixed in 5.0.0-beta.8
Development

Successfully merging this pull request may close these issues.

None yet

2 participants