New issue
Advanced search Search tips

Issue 612453 link

Starred by 3 users

Issue metadata

Status: WontFix
Owner: ----
Closed: May 2016
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 3
Type: Bug



Sign in to add a comment

Bogus SingletonLock file prevents the browser from running

Reported by ma...@endlessm.com, May 17 2016

Issue description

UserAgent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0

Steps to reproduce the problem:
On a POSIX system, chromium will fail to run if the SingletonLock file already exists under ~/.config/chromium AND is not a symlink file, but a directory or a regular file, printing the following in the output:

may 13 10:25:48 localhost gnome-session[741]: [11231:11231:0513/102548:ERROR:process_singleton_posix.cc(268)] Failed to create /home/test/.config/chromium/SingletonLock: File exists

STEPS: 
1. With chromium NOT running, manually create a regular file or directory in ~/.config/chromium/SingletonLock
2. Try to run chromium now

What is the expected behavior?
Chromium realizes that ~/.config/chromium/SingletonLock is not a valid lock file and removes it before trying to create it for the first time on startup, resulting in the browser launching and running properly.

What went wrong?
Chromium does not remove the bogus lock file/directory on startup, this failing to launch since it can't create the symlink file at its intended destination. 

Did this work before? No 

Chrome version: master (development)  Channel: dev
OS Version: Fedora23
Flash Version: Shockwave Flash 11.2 r202

Granted, this is an unlikely situation to easily run into, but if you run into it for whatever reason then is pretty obscure to figure out what's going on unless you read process_singleton_posix.cc, that makes it clear that this case is not checked:

  // Extract the hostname and pid from the lock symlink.
  // Returns true if the lock existed.
  bool ParseLockPath(const base::FilePath& path,
                     std::string* hostname,
                     int* pid) {
    std::string real_path = ReadLink(path).value();
    if (real_path.empty())
      return false;

    [...]

    return true;
  }

The problem here is that ReadLink() will return an empty string if the file pointed by path is not a symlink, resulting in ParseLockPath indicating that "a lock does not exist" and, thus, Create() failing when calling SymlinkPath(), since it can't create a symlink named like a file that already exists.

So, I think it would be nice to have an extra check in ParseLockPath() (or elsewhere) to make sure that chromium does not ever run into this situation.
 

Comment 1 by ma...@endlessm.com, May 17 2016

Patch under code review here: https://codereview.chromium.org/1984263002/

Comment 2 by mattm@chromium.org, May 17 2016

Labels: -Pri-2 Pri-3
Status: WontFix (was: Unconfirmed)
There are a billion ways you can break chrome by messing about in the config dir, we can't handle them all. I feel we shouldn't try to handle this unless it's something that can happen by itself.

Also the full list of I get when I run it seem helpful enough that someone got themselves into this state they could probably figure out how to get out:

[17989:17989:0517/111714:ERROR:process_singleton_posix.cc(246)] readlink(/tmp/chrm6/SingletonLock) failed: Invalid argument
[17989:17989:0517/111714:ERROR:process_singleton_posix.cc(246)] readlink(/tmp/chrm6/SingletonLock) failed: Invalid argument
[17989:17989:0517/111714:ERROR:process_singleton_posix.cc(270)] Failed to create /tmp/chrm6/SingletonLock: File exists
[17989:17989:0517/111714:ERROR:process_singleton_posix.cc(246)] readlink(/tmp/chrm6/SingletonLock) failed: Invalid argument
[17989:17989:0517/111714:ERROR:chrome_browser_main.cc(1379)] Failed to create a ProcessSingleton for your profile directory. This means that running multiple instances would start multiple browser processes rather than opening a new window in the existing process. Aborting now to avoid profile corruption.

Sign in to add a comment