New issue
Advanced search Search tips

Issue 643085 link

Starred by 2 users

Issue metadata

Status: Archived
Owner:
Closed: Sep 2016
Cc:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

VolumeManager::OnExternalStorageDisabledChanged() can be busy loop.

Project Member Reported by hidehiko@chromium.org, Sep 1 2016

Issue description

Version: ToT
OS: ChromeOS

https://cs.chromium.org/chromium/src/chrome/browser/chromeos/file_manager/volume_manager.cc?q=OnExternalStorageDisabledChanged&sq=package:chromium&dr=CSs&l=693

// We do not iterate on mount_points directly, because mount_points can
// be changed by UnmountPath().
// TODO(hidehiko): Is it necessary to unmount mounted archives, too, here?
while (!disk_mount_manager_->mount_points().empty()) {
  std::string mount_path =
      disk_mount_manager_->mount_points().begin()->second.mount_path;
  disk_mount_manager_->UnmountPath(
      mount_path,
      chromeos::UNMOUNT_OPTIONS_NONE,
      chromeos::disks::DiskMountManager::UnmountPathCallback());
}

The loop is wrong, because DiskMountManager::UnmountPath() is async call, so the mount_points() will not be updated in the next task cycle, but not in inside of the UnmountPath() method call.
It could cause busy unmount loop.

Yamaguchi-san, would you mind to take a look?

 
Status: Started (was: Untriaged)
Status: Fixed (was: Started)
Now I confirmed that, with revision 91a38bcb48c7e1eb4fb232d9e562c3c614fc19b8^ (the commit right before the fix), the remount loop did not finish even after a minute and freezes the entire UI.
It could also be confirmed by cros-disks log to /var/log/messages, as it repeatedly fails as the path is already unmounted.
> 2016-10-05T15:14:24.497692+09:00 ERR disks[3645]: Path '/media/removable/UNTITLED' is not mounted
> 2016-10-05T15:14:24.503796+09:00 ERR disks[3645]: last message repeated 19 times
(actually, the call happens more than thousands of times in a few second.)

After the change, the devices were successfully remounted. Files app can receive the "unmount finish" signal and reflects it to the UI.

Here is the detailed verification process.

REPRO STEPS:
1. Turn on device management and setup manager user, and a test user signed in to a client machine.
see: https://support.google.com/chrome/a/answer/2657289?hl=en&ref_topic=2936229
2. Sign in to Google admin console as a managing user. Find the policy option there.
   - Device management > Chrome > User Settings
   - Hardware - External Storage Devices
3. [On the client machine] Plug 1 or more external storage devices.
4. Open Files app and confirm those volumes appear in the left pane.
5. Open chrome://policy, filter by "ExternalStorage", and check "Show policies with no value set". Confirm ExternalStorageDisabled is not set.
6. [On Google admin console] Turn on ExternalStorageDisabled.
7. Choose turn "External Storage Devices" to "Disallow external storage devices", then save.
8. [On the client] Wait a few seconds or click "Reload policies" on the client, to wait until the policy is applied.

EXPECTED:
[On the client]
The external storage devices will disappear.

ACTUAL:
[On the client]
The entire screen freezes.

Thank you for verifying the fix! Busy loops are evil.

Comment 6 by dchan@chromium.org, Oct 7 2016

Labels: VerifyIn-55

Comment 7 by dchan@google.com, Nov 19 2016

Labels: VerifyIn-56

Comment 8 by dchan@google.com, Jan 21 2017

Labels: VerifyIn-57

Comment 9 by dchan@google.com, Mar 4 2017

Labels: VerifyIn-58

Comment 10 by dchan@google.com, Apr 17 2017

Labels: VerifyIn-59

Comment 11 by dchan@google.com, May 30 2017

Labels: VerifyIn-60
Labels: VerifyIn-61

Comment 13 by dchan@chromium.org, Oct 14 2017

Status: Archived (was: Fixed)

Sign in to add a comment