Closed Bug 1150691 Opened 10 years ago Closed 10 years ago

Cache Context close can race with storage invalidation

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla40
Tracking Status
firefox40 --- fixed

People

(Reporter: bkelly, Assigned: bkelly)

References

Details

Attachments

(1 file)

While working on bug 1110485 I discovered that there is a way for QuotaManager to clear storage without the Cache Manager getting marked as invalid: 1) Manager calls Context::AllowToClose() because it thinks its idle. 2) Context is released and destroyed on background thread. 3) Context schedules a runnable to release OfflineStorage on main thread. 4) QM invalidates OfflineStorage on main thread. 5) OfflineStorage tries to invalidate Context, but its already gone. 6) OfflineStorage is desotryed when runnable from step (3) runs. Also, the Manager is currently a bit sloppy in its determination of idle. Right now it just checks for Listener objects, but it should also look at CacheId and BodyId references.
Assignee: nobody → bkelly
Status: NEW → ASSIGNED
I guess I should add a comment somewhere that you must do one of the following to keep your Manager reference valid: 1) Add yourself as a listener by performing an op on the Manager 2) Call AddRefCacheId 3) Call AddRefBodyId All current consumers do this, but it may not be obvious. Alternatively, I could switch the "Manager is idle" check to a custom Release() method. I don't really want to do that, though.
Comment on attachment 8587649 [details] [diff] [review] Fix Cache API race with storage invalidation. r=ehsan Review of attachment 8587649 [details] [diff] [review]: ----------------------------------------------------------------- It would be lovely if you can add comment 2 somewhere in the code.
Attachment #8587649 - Flags: review?(ehsan) → review+
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: