New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 620713 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 1
Type: Bug



Sign in to add a comment

CacheStorage hangs

Project Member Reported by jkarlin@chromium.org, Jun 16 2016

Issue description

This is really a continuation of  issue 605663  but I'm creating a new issue since that was merged already.

The race between CacheStorage and QuotaManager has emerged once again.

1) Start a Cache::Put but before it checks quota size for the first time..
2) Run CacheStorage::Match

The Cache::Put will ask QuotaManager for storage size which will enqueue as a task in CacheStorage, but first match has to finish. But match can't finish until Put does, and we're hung.

 Issue 605663  fixed one way this race could occur but clearly left holes. We need a better solution.
 
I'm going to remove the call to determine available space left from the Put operation. It's going to be required as an input. Then all of the races go away and the code is simplified.
Status: Started (was: Assigned)
Implementing the fix in https://codereview.chromium.org/2085583002/. The CacheStorageCache will still call GetUsageAndQuota but it will do so before scheduling the operation. This means the storage estimate might happen well before the operation actually runs but at least it won't hang.
Project Member

Comment 3 by bugdroid1@chromium.org, Jun 21 2016

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

commit 36dc82c2b7539b33b63cb6f967feae265625d178
Author: jkarlin <jkarlin@chromium.org>
Date: Tue Jun 21 15:53:06 2016

[CacheStorage] Don't call GetUsageAndQuota from a scheduled operation

Scheduled operations run sequentially. GetUsageAndQuota() can sometimes create
a new Size() scheduled operation, so calling it while in a scheduled operation
can result in a hung CacheStorage. This CL moves the calls to GetUsageAndQuota
to just before the operations are scheduled. This means that the size estimate
is less accurate, as it's determined potentially well before the operation runs.

BUG= 620713 

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

[modify] https://crrev.com/36dc82c2b7539b33b63cb6f967feae265625d178/content/browser/cache_storage/cache_storage_cache.cc
[modify] https://crrev.com/36dc82c2b7539b33b63cb6f967feae265625d178/content/browser/cache_storage/cache_storage_cache.h
[modify] https://crrev.com/36dc82c2b7539b33b63cb6f967feae265625d178/content/browser/cache_storage/cache_storage_cache_unittest.cc

Labels: Merge-Request-52
Status: Fixed (was: Started)
Requesting merge into beta (m52) after this has baked for a day in canary.
Labels: Merge-Request-51
Also requesting merge to stable (m51) after baking in canary. This is a significant bug that has been hanging multiple sites.

Comment 6 by gov...@chromium.org, Jun 21 2016

Cc: pucchakayala@chromium.org
Labels: -Merge-Request-52 Merge-Approved-52
Approving merge to M52 branch 2743 based on comment #4. Please merge ASAP possibly before 4:00 PM PST today so we can take it for this week beta release. Thank you.

Comment 7 by gov...@chromium.org, Jun 21 2016

Also is this change applicable to All OS or any specific OS?
Labels: OS-All
All, updating the flag. Working on landing now.
Project Member

Comment 9 by bugdroid1@chromium.org, Jun 21 2016

Labels: -merge-approved-52 merge-merged-2743
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/91b7985947d77fcc337c03248508acf3ed018ce6

commit 91b7985947d77fcc337c03248508acf3ed018ce6
Author: Josh Karlin <jkarlin@chromium.org>
Date: Tue Jun 21 19:01:12 2016

[CacheStorage] Don't call GetUsageAndQuota from a scheduled operation

Merge into M52.

Scheduled operations run sequentially. GetUsageAndQuota() can sometimes create
a new Size() scheduled operation, so calling it while in a scheduled operation
can result in a hung CacheStorage. This CL moves the calls to GetUsageAndQuota
to just before the operations are scheduled. This means that the size estimate
is less accurate, as it's determined potentially well before the operation runs.

BUG= 620713 

Review-Url: https://codereview.chromium.org/2085583002
Cr-Commit-Position: refs/heads/master@{#401001}
(cherry picked from commit 36dc82c2b7539b33b63cb6f967feae265625d178)

Review URL: https://codereview.chromium.org/2081283002 .

Cr-Commit-Position: refs/branch-heads/2743@{#434}
Cr-Branched-From: 2b3ae3b8090361f8af5a611712fc1a5ab2de53cb-refs/heads/master@{#394939}

[modify] https://crrev.com/91b7985947d77fcc337c03248508acf3ed018ce6/content/browser/cache_storage/cache_storage_cache.cc
[modify] https://crrev.com/91b7985947d77fcc337c03248508acf3ed018ce6/content/browser/cache_storage/cache_storage_cache.h
[modify] https://crrev.com/91b7985947d77fcc337c03248508acf3ed018ce6/content/browser/cache_storage/cache_storage_cache_unittest.cc

Labels: Needs-Feedback
@jkarlin, i have tried using the steps to reproduce in  issue 605773  as this bug was filed as continuation.

Steps:
1. Open an incognito tab
2. Go to https://events.google.com/io2016/
3. Wait for "Caching Complete!" toast

I am able to see the Caching complete toast when i navigate to the above URL by opening a new incognito window. The toast is not seen when opened a new tab in the same incognito window.

Is this expected behavior ?

OS --> Win7 / 64 bit
Build --> 52.0.2743.49
That's the correct behavior, I believe the toast is only for the initial cache.

Comment 12 by tin...@google.com, Jun 22 2016

Labels: -Merge-Request-51 Merge-Review-51 Hotlist-Merge-Review
[Automated comment] Request affecting a post-stable build (M51), manual review required.
Labels: TE-Verified-M52 TE-Verified-52.0.2743.49
Thank you jkarlin@ for confirming the behavior.

Verified and the fix works fine on Mac OSX 10.11.5 & Linux/Ubuntu 14.04 - 52.0.2743.49 [Beta]

Hence marking the TE-Verified labels. Not marking the bug as Verified as the merge is still pending for M51 branch. 
Cc: sshruthi@chromium.org
Labels: -Merge-Review-51 Merge-Approved-51
Approving merge to M51 branch 2704 based on comment #5 & #13. Please merge asap. Thank you.
Project Member

Comment 15 by bugdroid1@chromium.org, Jul 1 2016

Labels: -merge-approved-51 merge-merged-2704
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/64d27590ccffe40abab3e9560bd886f3624eff23

commit 64d27590ccffe40abab3e9560bd886f3624eff23
Author: Josh Karlin <jkarlin@chromium.org>
Date: Fri Jul 01 13:16:10 2016

[CacheStorage] Don't call GetUsageAndQuota from a scheduled operation

Merge into branch 2704

Scheduled operations run sequentially. GetUsageAndQuota() can sometimes create
a new Size() scheduled operation, so calling it while in a scheduled operation
can result in a hung CacheStorage. This CL moves the calls to GetUsageAndQuota
to just before the operations are scheduled. This means that the size estimate
is less accurate, as it's determined potentially well before the operation runs.

BUG= 620713 

Review-Url: https://codereview.chromium.org/2085583002
Cr-Commit-Position: refs/heads/master@{#401001}
(cherry picked from commit 36dc82c2b7539b33b63cb6f967feae265625d178)

Review URL: https://codereview.chromium.org/2116783002 .

Cr-Commit-Position: refs/branch-heads/2704@{#729}
Cr-Branched-From: 6e53600def8f60d8c632fadc70d7c1939ccea347-refs/heads/master@{#386251}

[modify] https://crrev.com/64d27590ccffe40abab3e9560bd886f3624eff23/content/browser/cache_storage/cache_storage_cache.cc
[modify] https://crrev.com/64d27590ccffe40abab3e9560bd886f3624eff23/content/browser/cache_storage/cache_storage_cache.h
[modify] https://crrev.com/64d27590ccffe40abab3e9560bd886f3624eff23/content/browser/cache_storage/cache_storage_cache_unittest.cc

Sign in to add a comment