New issue
Advanced search Search tips

Issue 898145 link

Starred by 3 users

Issue metadata

Status: Archived
Owner:
Closed: Jan 3
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Bug



Sign in to add a comment

Space occupied by Blob inside IndexedDB is not freed after the entry is deleted or the store is cleared

Reported by 666...@googlemail.com, Oct 23

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0

Steps to reproduce the problem:
1. Open the supplied file in file:// origin
2. Add some data through "add data" button
3. Clear the used object store
4. Space occupied by blobs is not released, store is empty (checked through DevTools and object count)

What is the expected behavior?

What went wrong?
The space usage should drop after clearing the object store. Instead, the space occupied by the blobs is leaked and can only be restored by deleting the database.

In Firefox, the space is instantly freed.

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 70.0.3538.67  Channel: stable
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version:
 
dexie.html
1.9 KB View Download
Quoting https://crbug.com/795735#c3

    the backing store used by Indexed DB lazily compacts data written to the log, 
    so the quota estimations are approximate. Like memory/garbage collection, 
    the usage will grow until the database does a collection pass. 
    This enables higher throughput at the expense of reporting accuracy. 
    At some point - on the order of table sizes, which are in the low megabytes - 
    a threshold will be passed and the data will be restructured.

Devtools seems to force the compaction, see  bug 729790 .

Components: -Blink>Storage Blink>Storage>IndexedDB
Labels: Needs-Triage-M70
Cc: viswa.karala@chromium.org
Labels: Triaged-ET Needs-Feedback
Tried testing the issue on chrome reported version# 70.0.3538.67 using Windows-10 with steps mentioned below:
1) Launched chrome reported version, dragged and dropped the file provided in comment# 0
2) Clicked on "add data" button, seen value changed above 'count' button and 'estimate' button
3) Clicked on 'clear' button, able to see only data got cleared above 'count' button but not above the 'estimate' button

@Reporter: Please find the above mentioned information and attached screencast for your reference and provide your feedback on it which help in further triaging it it.

Thanks!
898145.PNG
12.1 KB View Download
Hi,

that's exactly the issue I'm experiencing. The digit above the count button shows the currently persisted row count (0 after clearing the store). However, the storage used by Blobs is not released and reported as used by the StorageManager and chrome://indexeddb-internals .

If ArrayBuffer is used, however, the used space is reclaimed after more data is written to the database.

I've added a button to add both Blobs and ArrayBuffers to demonstrate the issue. If ArrayBuffers are used, Chromium also seems to compact the contents and uses less space (the buffers consist of 0x00, not part of the issue).
dexie.html
2.7 KB View Download
Project Member

Comment 6 by sheriffbot@chromium.org, Oct 26

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding the requester to the cc list.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Owner: dmurph@google.com
Status: Available (was: Unconfirmed)
dmurph@: Please investigate?

I suspect that we keep the Blob file around until garbage collection, because the renderer still has a handle to the Blob. We could use DevTools to verify this hypothesis.
Status: Assigned (was: Available)
Labels: -Pri-2 Pri-3
Also, this can be done once Scopes is over, if you want to look into IDBBackingStore.
We already have situations where a blob can become detached, for example when clear-site-data is used.  Since this state already exists to some degree, maybe we could propose an explicit `.detach()` or something to explicitly close the handle.  That could help the case where you want to get rid of something large deliberately, but also explain other corner cases in the platform.
Cc: mek@chromium.org
Status: WontFix (was: Assigned)
This is because the blob also have a reference in the renderer, and we rely on garbage collection to destroy the JS blob object, which will delete the underlying file.

If a URL was created for the blob, then this will cause the blob to stay alive until that URL is revoked by the website author.

We used to have a 'close()' method, but it turns out there are a lot of edge cases with blobs, as they can be shared between browsing contexts & origins, and their urls can also be sent around indiscriminately.

So basically, it looks like this is WAI, unless we see that the blob data isn't destroyed on JS garbage collection. Please re-open / re-comment if this is the case.

Adding mek@ just in case - they did a lot of work in this space.

Labels: Needs-Feedback
Status: Assigned (was: WontFix)
Actually I have one question here for #1 - does javascript ever read in this data? Or is it always in IndexedDB?
Owner: dmu...@chromium.org
Status: Archived (was: Assigned)

Sign in to add a comment