New issue
Advanced search Search tips

Issue 617683 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Jul 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

If profile is closed while Put operation is writing content, an invalid entry could remain

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

Issue description

The Put operation works like so:
1) Metadata written to cache in one Write
2) Content written to cache in several Writes

If the threads are stopped during content write

If, during step 3, the browser is closed, an incomplete entry remains in the cache.
 
We need to make sure that the caches are destructed on shutdown. Destructing a cache should cause any open disk_cache entries that are being written to to be doomed.

Today this isn't the case. Callers of cache operations carry a cache refptr in their callback to keep the cache alive throughout the operation. Those refptrs should be held by the clients instead of the callbacks so that when the dispatchers close the caches can destruct. 
Project Member

Comment 2 by bugdroid1@chromium.org, Jun 8 2016

Project Member

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

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

commit ec7a87d4b4e2707ab7ad19a3125dbaed9cd2ad2a
Author: jkarlin <jkarlin@chromium.org>
Date: Thu Jun 09 14:33:04 2016

Revert of [CacheStorage] Clean up CacheStorageCache lifetimes (patchset #3 id:60001 of https://codereview.chromium.org/2040173002/ )

Reason for revert:
Rather than carefully control the lifetimes of the refptrs, I'm going to give explicit ownership of caches to CacheStorage so that on ~CacheStorage the caches die. CacheStorage will give clients handles to the caches (that extend the lifetime but not past destruction).

Original issue's description:
> [CacheStorage] Clean up CacheStorageCache lifetimes
>
> CacheStorageCache refptrs are held in callbacks to cache operations, meaning that they won't be destructed
> on profile shutdown.  This CL moves the refptrs to member variables so that they will.
>
> BUG= 617683 
>
> Committed: https://crrev.com/f9b13e0a9790f868a54ad4f3d1268d7369239ed4
> Cr-Commit-Position: refs/heads/master@{#398529}

TBR=jochen@chromium.org,nhiroki@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG= 617683 

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

[modify] https://crrev.com/ec7a87d4b4e2707ab7ad19a3125dbaed9cd2ad2a/content/browser/cache_storage/cache_storage.cc
[modify] https://crrev.com/ec7a87d4b4e2707ab7ad19a3125dbaed9cd2ad2a/content/browser/cache_storage/cache_storage.h
[modify] https://crrev.com/ec7a87d4b4e2707ab7ad19a3125dbaed9cd2ad2a/content/browser/cache_storage/cache_storage_cache.cc
[modify] https://crrev.com/ec7a87d4b4e2707ab7ad19a3125dbaed9cd2ad2a/content/browser/cache_storage/cache_storage_dispatcher_host.cc
[modify] https://crrev.com/ec7a87d4b4e2707ab7ad19a3125dbaed9cd2ad2a/content/browser/cache_storage/cache_storage_dispatcher_host.h
[modify] https://crrev.com/ec7a87d4b4e2707ab7ad19a3125dbaed9cd2ad2a/content/browser/renderer_host/render_message_filter.cc
[modify] https://crrev.com/ec7a87d4b4e2707ab7ad19a3125dbaed9cd2ad2a/content/browser/renderer_host/render_message_filter.h

Owner: jkarlin@chromium.org
Status: Started (was: Available)
Project Member

Comment 5 by bugdroid1@chromium.org, Jun 15 2016

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

commit ec7a87d4b4e2707ab7ad19a3125dbaed9cd2ad2a
Author: jkarlin <jkarlin@chromium.org>
Date: Thu Jun 09 14:33:04 2016

Revert of [CacheStorage] Clean up CacheStorageCache lifetimes (patchset #3 id:60001 of https://codereview.chromium.org/2040173002/ )

Reason for revert:
Rather than carefully control the lifetimes of the refptrs, I'm going to give explicit ownership of caches to CacheStorage so that on ~CacheStorage the caches die. CacheStorage will give clients handles to the caches (that extend the lifetime but not past destruction).

Original issue's description:
> [CacheStorage] Clean up CacheStorageCache lifetimes
>
> CacheStorageCache refptrs are held in callbacks to cache operations, meaning that they won't be destructed
> on profile shutdown.  This CL moves the refptrs to member variables so that they will.
>
> BUG= 617683 
>
> Committed: https://crrev.com/f9b13e0a9790f868a54ad4f3d1268d7369239ed4
> Cr-Commit-Position: refs/heads/master@{#398529}

TBR=jochen@chromium.org,nhiroki@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG= 617683 

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

[modify] https://crrev.com/ec7a87d4b4e2707ab7ad19a3125dbaed9cd2ad2a/content/browser/cache_storage/cache_storage.cc
[modify] https://crrev.com/ec7a87d4b4e2707ab7ad19a3125dbaed9cd2ad2a/content/browser/cache_storage/cache_storage.h
[modify] https://crrev.com/ec7a87d4b4e2707ab7ad19a3125dbaed9cd2ad2a/content/browser/cache_storage/cache_storage_cache.cc
[modify] https://crrev.com/ec7a87d4b4e2707ab7ad19a3125dbaed9cd2ad2a/content/browser/cache_storage/cache_storage_dispatcher_host.cc
[modify] https://crrev.com/ec7a87d4b4e2707ab7ad19a3125dbaed9cd2ad2a/content/browser/cache_storage/cache_storage_dispatcher_host.h
[modify] https://crrev.com/ec7a87d4b4e2707ab7ad19a3125dbaed9cd2ad2a/content/browser/renderer_host/render_message_filter.cc
[modify] https://crrev.com/ec7a87d4b4e2707ab7ad19a3125dbaed9cd2ad2a/content/browser/renderer_host/render_message_filter.h

Project Member

Comment 6 by bugdroid1@chromium.org, Jun 22 2016

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

commit fdde54f517cf14382dbeb4217a9e647563a2e671
Author: jkarlin <jkarlin@chromium.org>
Date: Wed Jun 22 16:49:12 2016

[CacheStorage] Give ownership of all CacheStorageCaches to CacheStorage

This Cl removes ref counting on CacheStorageCache. Caches are now
owned by CacheStorage. CacheStorage hands out handles to the cache
to clients. The handles are ref counted and CacheStorage will delete
the cache in its own destructor or when the last cache handle is
deleted.

BUG= 617683 

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

[modify] https://crrev.com/fdde54f517cf14382dbeb4217a9e647563a2e671/content/browser/cache_storage/cache_storage.cc
[modify] https://crrev.com/fdde54f517cf14382dbeb4217a9e647563a2e671/content/browser/cache_storage/cache_storage.h
[modify] https://crrev.com/fdde54f517cf14382dbeb4217a9e647563a2e671/content/browser/cache_storage/cache_storage_cache.cc
[modify] https://crrev.com/fdde54f517cf14382dbeb4217a9e647563a2e671/content/browser/cache_storage/cache_storage_cache.h
[add] https://crrev.com/fdde54f517cf14382dbeb4217a9e647563a2e671/content/browser/cache_storage/cache_storage_cache_handle.cc
[add] https://crrev.com/fdde54f517cf14382dbeb4217a9e647563a2e671/content/browser/cache_storage/cache_storage_cache_handle.h
[modify] https://crrev.com/fdde54f517cf14382dbeb4217a9e647563a2e671/content/browser/cache_storage/cache_storage_cache_unittest.cc
[modify] https://crrev.com/fdde54f517cf14382dbeb4217a9e647563a2e671/content/browser/cache_storage/cache_storage_dispatcher_host.cc
[modify] https://crrev.com/fdde54f517cf14382dbeb4217a9e647563a2e671/content/browser/cache_storage/cache_storage_dispatcher_host.h
[modify] https://crrev.com/fdde54f517cf14382dbeb4217a9e647563a2e671/content/browser/cache_storage/cache_storage_manager_unittest.cc
[modify] https://crrev.com/fdde54f517cf14382dbeb4217a9e647563a2e671/content/browser/cache_storage/cache_storage_unittest.cc
[modify] https://crrev.com/fdde54f517cf14382dbeb4217a9e647563a2e671/content/browser/renderer_host/render_message_filter.cc
[modify] https://crrev.com/fdde54f517cf14382dbeb4217a9e647563a2e671/content/browser/renderer_host/render_message_filter.h
[modify] https://crrev.com/fdde54f517cf14382dbeb4217a9e647563a2e671/content/browser/service_worker/service_worker_browsertest.cc
[modify] https://crrev.com/fdde54f517cf14382dbeb4217a9e647563a2e671/content/content_browser.gypi

Comment 7 by jsb...@chromium.org, Jul 25 2016

Is this complete or is there more work remaining?
Status: Fixed (was: Started)
All done.

Sign in to add a comment