Open Bug 1674326 Opened 4 years ago Updated 1 month ago

When the site usage is near its quota, Cache.delete() sometimes fails with a quota error

Categories

(Core :: Storage: Quota Manager, defect, P3)

Firefox 82
defect

Tracking

()

People

(Reporter: cpnspam+git, Unassigned)

References

Details

(Whiteboard: dom-lws-bugdash-triage)

Steps to reproduce:

I don't know if a service worker is necessary, but my code is doing the following actions in a service worker.
It stores a few MB of data to an object store in indexedDB and a couple of GB of data (for testing purposes) to a cache. (Non-persistent storage is used for this test since persistent storage always reports 0 usage.)
When a cache write fails with NS_ERROR_FILE_NO_DEVICE_SPACE, it uses Cache.delete() to delete selected URLs from the cache to try to free up some space.

Actual results:

About 10-20% of the time (probably depending on the exact usage), the Cache.delete() promise is rejected with an NS_ERROR_FILE_NO_DEVICE_SPACE error, and the cache entry is not deleted.

Expected results:

Being near or over quota should not prevent a delete from completing. If delete doesn't work, there is no way for the service worker to recover.

Summary: When the site usage is near its quota, IDBObjectStore.delete() claims to succeed but doesn't delete the record → When the site usage is near its quota, Cache.delete() sometimes fails with a quota error

Unlike in bug 1674325, waiting 5 seconds and attempting to delete again never seems to work.

See Also: → 1674325

Simon, could you please take a look over this when you get a chance?
Seems to be similar with bug 1674325.
Thanks!

Flags: needinfo?(sgiesecke)

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Storage: Quota Manager
Product: Firefox → Core
Flags: needinfo?(simon.giesecke)
Severity: -- → S3
Priority: -- → P3
Whiteboard: dom-lws-bugdash-triage

This is a simpler situation than bug 1674325 where the SQLite transaction would be scoped only to deletion and we can allow temporary relaxation of the storage constrains via (this is currently IDB-specific code, but can be used by Cache) DisableQuotaChecks like IDB [does for its cleanup transaction mechanism](https://searchfox.org/mozilla-central/rev/d3fea1aa852bb3a353a0a4a875c3685da11ce39b/dom/indexedDB/ActorsParent.cpp#96470. We might want to make sure that we checkpoint/similar.

Status: UNCONFIRMED → NEW
Ever confirmed: true
You need to log in before you can comment on or make changes to this bug.