-
Notifications
You must be signed in to change notification settings - Fork 862
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
Handle stale lockfiles in Muon browser profile #1105
Conversation
Noticed a minor issue on Windows. In the regression test where I confirm that the original profile lock functionality is preserved, the following occurs:
Previously, the "Close Brave" dialog ended up in the foreground of all other windows on the desktop. After this change, the following occurs:
Why does Muon get foregrounded? Probably due to the "Notify" portion of |
Confirmed that the issue of potentially obscuring the "Close Brave" dialog only affects Windows. On macOS and Linux, Muon also gets foregrounded, but the "Close Brave" dialog still ends up on top of all the foregrounded Muon windows and is easily visible. This actually makes for a rather convenient user experience, in that it both explains that they need to quit Muon to continue the import and also shows Muon windows prominently, which makes it easy to find a Muon window and quit it from there. Also confirmed that the Test Plan succeeds on macOS and Linux. I need to do some more testing on Windows, because the underlying mechanism, |
After further testing, I cannot even reproduce the test plan on Windows on master. Even when I do what (as far as I know) is the closest equivalent to That suggests we only need to clean up stale lockfiles on macOS and Linux, so we should probably limit the change to those platforms because of the undesirable "Close Brave (old)" dialog covering behavior. |
I decided to split the difference and retain the original behavior on Windows, while adding the new stale lockfile handling on macOS and Linux, because:
Since I can't confirm that this PR improves things on Windows, but do now it creates a UI regression for the case where a user does a manual import while Muon is still open, I think it's best to keep things as they are on Windows and only implement this fix on macOS and Linux. If more information comes to light, or someone is able to help me find a way to reproduce this issue on Windows, I'd be happy to take another look. |
ChromeProfileLock tests are failing, looking into it now. |
All tests are passing, this is ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++
@garrettr uplift request to Before requesting uplift approval for |
Handle stale lockfiles in Muon browser profile
Handle stale lockfiles in Muon browser profile
Handle stale lockfiles in Muon browser profile
Resolves brave/brave-browser#2503.
If the initial attempt to create the ProcessSingleton fails, it may be the case that there are stale lockfiles or an unresponsive process holding lockfiles for Muon's user data directory. This PR will retry acquiring the browser profile lock with
ProcessSingleton::NotifyOtherProcessOrCreatte
, which attempts to handle those edge cases.Tested and confirmed to work on macOS; waiting on builds to confirm this approach also works on Windows and Linux.
Submitter Checklist:
npm test brave_unit_tests && npm test brave_browser_tests
) ongit rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
This PR only needs to be tested on macOS and Linux. I tried but was unable to come up with a reproducible test plan for Windows.
Singleton{Cookie,Lock,Socket}
, in Muon's user data directory, e.g. on macOS:ls -l ~/Library/Application\ Support/brave/Singleton*
SingletonLock
, e.g. on macOS:readlink ~/Library/Application\ Support/brave/SingletonLock | awk -F- '{print $NF}'
kill -9 <muon PID>
Importing all data types from Muon should be successful. You should not see the "Close Brave (old)" dialog.
Reviewer Checklist: