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 descriptionUserAgent: 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:
,
Oct 23
,
Oct 23
,
Oct 26
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!
,
Oct 26
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).
,
Oct 26
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
,
Oct 26
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.
,
Oct 26
,
Oct 26
Also, this can be done once Scopes is over, if you want to look into IDBBackingStore.
,
Oct 27
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.
,
Oct 30
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.
,
Oct 30
Actually I have one question here for #1 - does javascript ever read in this data? Or is it always in IndexedDB?
,
Nov 2
,
Jan 3
|
||||||||||||
►
Sign in to add a comment |
||||||||||||
Comment 1 by woxxom@gmail.com
, Oct 23