Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
M103: Merge three CLs for fixing launch failures.
CLs merged in this CL are 9c26f9b: This change addresses known launch/shutdown/update-swap races. 393e286: Change IsBrowserAlreadyRunning back to using PathService. a980af7: Change IsBrowserAlreadyRunning to detect browser in same dir. No conflicts were found in any of these merges. A full build and manual test for issue 1314491 was carried out. BUG=1314491 CLs enclosed below: This change addresses known launch/shutdown/update-swap races. We check IsRunningOldChrome in PreEarlyInitialization to relaunch immediately if we are running stale binaries. Calling DoUpgradeTasks at that point is not safe as the browser process singleton is not owned. We call DoUpgradeTasks right after an instance obtains the singleton, which is the only safe way to perform the swap. We no longer cache IsBrowserAlreadyRunning as doing so results in races. The value must be checked while owning the singleton and not using a stored value from before. DoUpgradeTasks checks for IsBrowserAlreadyRunning to perform the swap and also checks if we are running stale binaries. This is necessary as an instance that previously owned the singleton could have done a swap prior to the new one getting the singleton. This is not the ideal solution, but it is a substantial improvement. Ideally, we would have a cross-process mutex (like the browser singleton) but use it all the way from PreEarlyInitialization. Doing that is a design change which we can decide to do if the problem is still severe after all mitigations discussed in Bug 1314491 are in place. Bug: 1314491 Change-Id: I7bd42550f49b2f0e58b585a08364ae1be4cec242 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3656507 Reviewed-by: Greg Thompson <grt@chromium.org> Reviewed-by: Will Harris <wfh@chromium.org> Reviewed-by: Bruce Dawson <brucedawson@chromium.org> Reviewed-by: Scott Violet <sky@chromium.org> Commit-Queue: Javier Flores Assad <floresa@microsoft.com> Cr-Commit-Position: refs/heads/main@{#1006064} (cherry picked from commit 9c26f9b) Change IsBrowserAlreadyRunning back to using PathService. A previous CL changed the behavior here to use QueryFullProcessImageName instead of PathService, which uses GetModuleFileName under the hood, which reads the value from the Process Environment Block (PEB) of the process. Using QueryFullProcessImageName was incorrect, as chrome might have been renamed between it starting and the first call to IsBrowserAlreadyRunning in PreEarlyInitialization by another chrome that started at exactly the wrong time. However, this bug did not actually manifest, because of a quirk in QueryFullProcessImageName where it does not correctly function if the file has been moved then renamed and instead returns the 'wrong' value which is from the PEB rather than the 'right' value which would have been wrong. Because the setup --rename-chrome-exe command moves the file into a scoped temp directory e.g. %localappdata%\Google\Chrome SxS\Temp\scoped_dir4752_305957221\old_chrome.exe it meant that, purely by a coincidence of two bugs, this code was never actually truly faulty. However, if QueryFullProcessImageName behavior were to ever change then using this API would be incorrect as the Event should always be named after the installation path, and not the scoped temp dir. Therefore, this change reverts the change back to using PathService / GetModuleFileName, but retains the correct behavior of both using an NT path, which fixes the bug described in comment 24, and using the executable parent directory and not the executable filename, which fixes the bug described in comment 27. BUG=1314491 Change-Id: I8ab01e56906820fdd53d1ba502df8acbf5a287c1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3655886 Reviewed-by: Greg Thompson <grt@chromium.org> Commit-Queue: Will Harris <wfh@chromium.org> Cr-Commit-Position: refs/heads/main@{#1005885} (cherry picked from commit 393e286) Change IsBrowserAlreadyRunning to detect browser in same dir. This change makes IsBrowserAlreadyRunning detect any chrome executable running from the same (parent) directory as being the same running browser. E.g. c:\chrome\new_chrome.exe will now be considered the 'same' as c:\chrome\chrome.exe. This means that if a shortcut points to new_chrome.exe (or old_chrome.exe) and there is also a running chrome.exe, then chrome will be considered already running, and rendez-vous with the existing browser will be carried out, and no upgrade tasks will be performed. This is an extension to crrev.com/c/3617153. BUG=1314491 (cherry picked from commit a980af7) Change-Id: Ib61f17f277aa8ab47f38b8c2888a5abb7494d8a4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3645291 Reviewed-by: Gabriel Charette <gab@chromium.org> Commit-Queue: Will Harris <wfh@chromium.org> Cr-Original-Commit-Position: refs/heads/main@{#1003226} Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3668941 Reviewed-by: Scott Violet <sky@chromium.org> Cr-Commit-Position: refs/branch-heads/5060@{#310} Cr-Branched-From: b83393d-refs/heads/main@{#1002911}
- Loading branch information