New issue
Advanced search Search tips

Issue 722749 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner: ----
Closed: Jun 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 3
Type: Bug



Sign in to add a comment

SingletonLock created by process from another host is not unlinked if we cannot write/read socket

Reported by seren.al...@gmail.com, May 16 2017

Issue description

This bug affects all Linux and Mac versions. The steps that leads to this bug:
- profile is locked by process on another host
- we start new instance of browser
- browser finds and connects to singleton socket to send notification
- for any reason browser failed to read/write to singleton socket
- browser reads SingletonLock and finds that locking process is on another host
- browser decides to create own ProcessSingleton

On the last step browser should unlink existing SingletonLock. Currently this doesn’t happen.

So currently in this case ProcessSingleton is not created on Linux. On Mac this leads to extra checking and running flock() which is redundant.
 
By code investigation following issues were found:

First issue:
1. Chrome is run.
2. Hostname is changed.
3. Chrome crashes, leaving the lock file with the old hostname.
4. A different chrome runs with a different user-data-dir and just happens to
get the same pid as from step #1.
5. Chrome is run again with the original user-data-dir. It sees there is a lock
file with a different hostname, but sees that there is a chrome process with the
same pid, so it can reach the KillProcessByLockPath in the connect retry loop.

In this case, lockfile is not deleted. We need to delete lock file without killing anything.


Second issue:
1. Chrome is run.
2. Hostname is changed.
3. Chrome freezes, it's still listening on the socket with the old hostname, but
not responding to any messages.
4. Chrome is run again. It can connect to the socket, but times out waiting for
a response, hitting one of read timeout or write timeout KillProcessByLockPath
calls.

In this case, we'd actually want to kill the frozen chrome in addition to deleting the lockfile, which the code currently doesn't do.

Labels: Needs-Feedback
Please provide a server crash id for the "first issue" crash. For the second issue, please use Activity Monitor to take a sample of Chrome when it freezes.
Components: Blink>Network>WebSockets

Comment 4 by ricea@chromium.org, Jun 6 2017

Components: -Blink>Network>WebSockets UI>Browser>Profiles
This isn't WebSocket-related. I think it concerns the ProcessSingleton class in //chrome. I am guessing that UI>Browser>Profile is the correct component.
Project Member

Comment 5 by bugdroid1@chromium.org, Jun 6 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/67095448eb212b9f8e09f071515669d9618e7534

commit 67095448eb212b9f8e09f071515669d9618e7534
Author: aseren <aseren@yandex-team.ru>
Date: Tue Jun 06 18:14:12 2017

Fix process_singleton_posix handling of hostname changes not deleting a stale
lockfile or not killing a frozen browser.

First issue:
1. Chrome is run.
2. Hostname is changed.
3. Chrome crashes, leaving the lock file with the old hostname.
4. A different chrome runs with a different user-data-dir and just happens to
get the same pid as from step #1.
5. Chrome is run again with the original user-data-dir. It sees there is a lock
file with a different hostname, but sees that there is a chrome process with the
same pid, so it can reach the KillProcessByLockPath in the connect retry loop.

In this case, lockfile is not deleted. We need to delete lock file without killing anything.

Second issue:
1. Chrome is run.
2. Hostname is changed.
3. Chrome freezes, it's still listening on the socket with the old hostname, but
not responding to any messages.
4. Chrome is run again. It can connect to the socket, but times out waiting for
a response, hitting one of read timeout or write timeout KillProcessByLockPath
calls.

In this case, we'd actually want to kill the frozen chrome in addition to deleting the lockfile, which the code currently doesn't do.

CL fixes both of these issues.

R=jochen@chromium.org, mattm@chromium.org
BUG= 722749 

Review-Url: https://codereview.chromium.org/2880333004
Cr-Commit-Position: refs/heads/master@{#477342}

[modify] https://crrev.com/67095448eb212b9f8e09f071515669d9618e7534/chrome/browser/process_singleton.h
[modify] https://crrev.com/67095448eb212b9f8e09f071515669d9618e7534/chrome/browser/process_singleton_posix.cc
[modify] https://crrev.com/67095448eb212b9f8e09f071515669d9618e7534/chrome/browser/process_singleton_posix_unittest.cc

Alexey, is it fixed? Should I close the bug?

Comment 7 by ew...@chromium.org, Jun 15 2017

Friendly ping. Can we close this bug and mark is as Fixed?
I'm sorry for the late answer. The issue was fixed now and we can mark it as Fixed.
Project Member

Comment 9 by sheriffbot@chromium.org, Jun 21 2017

Cc: shrike@chromium.org
Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "shrike@chromium.org" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: -shrike@chromium.org
Status: Fixed (was: Unconfirmed)

Sign in to add a comment