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

revert: add first-instance-ack event to the app.requestSingleInstanceLock() flow #34297

Merged
merged 1 commit into from May 23, 2022

Conversation

VerteDinde
Copy link
Member

@VerteDinde VerteDinde commented May 19, 2022

Description of Change

Closes #33566

PR #31460 added a new first-instance ack event, which uses named pipes under the hood. However, named pipes are not session-specific like the window and mutex objects that are used to synchronize/communicate between processes. Because of this, pipes meant for one app will collide with another and cause a deadlock. (A fix for this was attempted in #34139)

Even after making the named pipes session-specific, there is still a race condition where if multiple "second instances" of different Electron apps (or of the same app) run at the same time, they could get acks meant for other ones. This means that two Electrons apps with the same name, being used by the same user, could collide as long as one us using Electron 18+. We were also seeing this issue with a single Electron app creating a second instance, such as an HTML notification window.

There's a plan to refactor this to move away from named pipes and use MessageWindow instead (see #34235). Because Electron 19 is close to stable release, and more users will be upgrading to both Electron 19 and Electron 18, we've decided to revert the original named pipe change and reland a future refactor using MessageWindow. This PR reverts the original change.

Checklist

Release Notes

Notes: Notes: Fixed an issue where running second instances of the same application would cause a deadlock on Windows.

@VerteDinde VerteDinde added semver/minor backwards-compatible functionality target/18-x-y labels May 19, 2022
@electron-cation electron-cation bot added api-review/requested 🗳 new-pr 🌱 PR opened in the last 24 hours labels May 19, 2022
@VerteDinde VerteDinde marked this pull request as ready for review May 19, 2022 23:58
@VerteDinde VerteDinde requested review from a team as code owners May 19, 2022 23:58
@nornagon
Copy link
Member

API LGTM

@trop
Copy link
Contributor

trop bot commented May 20, 2022

@VerteDinde has manually backported this PR to "18-x-y", please check out #34295

@codebytere codebytere changed the title fix: Revert "feat: add first-instance-ack event to the app.requestSingleInstanceLock() flow" revert: add first-instance-ack event to the app.requestSingleInstanceLock() flow May 20, 2022
Copy link
Contributor

@itsananderson itsananderson left a comment

Choose a reason for hiding this comment

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

API LGTM

@MarshallOfSound MarshallOfSound added the fast-track 🚅 Indicates that this PR is intended to bypass the 24 hour rule. Needs approval from Releases label May 22, 2022
@electron-cation electron-cation bot removed new-pr 🌱 PR opened in the last 24 hours api-review/requested 🗳 labels May 22, 2022
@VerteDinde
Copy link
Member Author

WOA failure is a flake and unrelated

@VerteDinde VerteDinde merged commit 38c21b7 into main May 23, 2022
@VerteDinde VerteDinde deleted the revert-ackpipe branch May 23, 2022 05:20
@release-clerk
Copy link

release-clerk bot commented May 23, 2022

Release Notes Persisted

Notes: Fixed an issue where running second instances of the same application would cause a deadlock on Windows.

@trop
Copy link
Contributor

trop bot commented May 23, 2022

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

@trop
Copy link
Contributor

trop bot commented May 23, 2022

@VerteDinde has manually backported this PR to "19-x-y", please check out #34312

khalwa pushed a commit to solarwindscloud/electron that referenced this pull request Feb 22, 2023
…eLock()` flow (electron#34297)

fix: revert "feat: add first-instance-ack event to the `app.requestSingleInstanceLock()` flow"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fast-track 🚅 Indicates that this PR is intended to bypass the 24 hour rule. Needs approval from Releases semver/minor backwards-compatible functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: After v18, an app using requestSingleInstanceLock() will crash if a lower version also starts.
6 participants