indexedDB broken - UnknownError - Error opening Database

NEW
Unassigned

Status

()

Core
DOM: IndexedDB
4 years ago
3 months ago

People

(Reporter: Aymeric Vitte, Unassigned)

Tracking

25 Branch
x86
Windows Vista
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

4 years ago
User Agent: Mozilla/5.0 (Windows NT 6.0; rv:25.0) Gecko/20100101 Firefox/25.0 (Beta/Release)
Build ID: 20131112160018

Steps to reproduce:

I don't know how to reproduce it exactly because for now indexedDB is broken and whatever I do, trying to open/create a Database, I get:

[17:46:53.492] UnknownError @ https://xxx.js:8262
[17:46:53.492] "Error opening database" 

It happened after trying to encrypt large files doing:

Blob --> worker --> slice Blob --> encrypt chunk --> postMessage chunk --> collect chunks --> store new Blob([encrypted Blob, chunks]) in IDB every 2MB of chunks where encryptedBlob is the already encrypted Blob part retrieved from IDB

'store tasks' are queued and executed sequentially, each one executing after the previous one completed successfully (ie IDB write), but the implementation is under testing and maybe not exactly correct, so I suspect concurrent access on IDB.


Actual results:

IDB is broken, it's not limitated to the Database that created the issue, it can not be used any longer.
(Reporter)

Comment 1

4 years ago
It seems to be broken only for the domain that created the problem, impossible to open/create Databases any longer, deleteDatabase does not work, I tried Nightly too, nothing to do...

How can I clear/reset IDB?
(Reporter)

Comment 2

4 years ago
See #945281 for a reduced test case.

I still don't know exactly how to reproduce it but maybe the issue appears while doing something between console.log('get') and onsuccess (clearing the page, relaunching the same script...)
Component: Untriaged → DOM: IndexedDB
Product: Firefox → Core
(Reporter)

Comment 3

4 years ago
This is happening again, while opening an already created database on a specific domain, I systematically get 'Unknown Error'.

While I still don't know the cause, the problem was recurent and could be solved deleting indexedDB files, but now it seems impossible to revert, deleting files in indexedDB profile directory does not work, deleting indexedDB directory does not work either.

So on this domain indexedDB can not be used any longer, thanks to let me know what to do to identify the problem and how to recover.
(Reporter)

Comment 4

4 years ago
Update: clearing the file related to the domain in storage/persistent did allow to reuse indexedDB for that domain (the indexedDB directory seems not to be used any longer (??))

Is there not a simple way to clear indexedDB?
If you want to delete *all* the data that the web site has stored on your computer you can use the "Page Info" feature to do it. See https://support.mozilla.org/en-US/kb/page-info-window-view-technical-details-about-page#w_maintain-offline-storage to see the controls. You can click the "Clear Storage" button to remove the databases.

Sorry that this particular form of storage is difficult to clear, there are bugs open on trying to improve our UI.
(Reporter)

Comment 6

4 years ago
Sorry, I must be misreading the link you provided, where is the "Clear Storage" button?

What about "unknown error"? I have seen other bugs related to it but this does not seem to apply to my case, how to track this?
(In reply to Aymeric Vitte from comment #6)
> Sorry, I must be misreading the link you provided, where is the "Clear
> Storage" button?

It should show up in the permissions list in the "Maintain Offline Storage" section if the page has any data stored in indexedDB.

> What about "unknown error"? I have seen other bugs related to it but this
> does not seem to apply to my case, how to track this?

Sorry, I didn't read much past "Is there not a simple way to clear indexedDB?". This part will be harder to figure out.

Anything unusual about your profile location? Is it on a network drive or anything like that?
(Reporter)

Comment 8

4 years ago
I still don't see the "clear storage" button in permissions for a site that has indexedDB data stored, even with Nightly, maybe it will come later...

Nothing unusual with my profile location, this happens with http://www.peersm.com project, periodically the database gets broken and I can not figure out why for now.
Created attachment 8356204 [details]
screenshot.jpg

This is what the dialog should look like if the web site is actually storing data. The 'Clear Storage' button will be not appear if there is no data being stored.
(Reporter)

Comment 10

4 years ago
Ah, OK, not very intuitive to find it...
(Reporter)

Comment 11

4 years ago
Database broken is really happening very often, I still don't know the cause, any advise to investigate this?
(Reporter)

Comment 12

3 years ago
If you activate the private navigation mode (options/privacy), disable history and cookies then you get the very same behavior, indexedDB can't be accessed, I don't know if it is related to the cause of this bug but it seems similar.

This raises another question: how do we globally forbid any type of local storage or ask for permission?

Right now you can do it on a per site basis using the "page info" but by default all different types of local storage do not ask you anything, I don't find it normal at all, that's a security issue, any site can store whatever it likes, and I can not find where to force the browser to ask for permission for anything stored

Comment 13

3 years ago
I can confirm this database corruption though I am not sure if it is related - it might. I am using the database for large amounts of chunks of binary data. After using "clear recent history" with option everything but cookies, the database was completely corrupted with "unknown errors" popping around just for trying to open the database. Only a rm -rf in the appropriate storage directory (deleting all persistent storage for that domain) allowed indexdb access again.
I think this is what we're seeing with the new Thimble for some users in Firefox, for example: https://github.com/mozilla/thimble.webmaker.org/issues/1031#issuecomment-137113124

We host the filesystem in IndexedDB, and for some Firefox users, it just seems get corrupted right away:

Filer error: Object { name: "EINVAL", code: "EINVAL", errno: 18, message: "IndexedDB cannot be accessed. If pr…", stack: "e@https://mozillathimblelivepreview…" } bramble.js:3:4004

We haven't had reports of this in any other browser
Status: UNCONFIRMED → NEW
Ever confirmed: true
(In reply to David Humphrey (:humph) from comment #14)
> I think this is what we're seeing with the new Thimble for some users in
> Firefox, for example:
> https://github.com/mozilla/thimble.webmaker.org/issues/1031#issuecomment-
> 137113124
> 
> We host the filesystem in IndexedDB, and for some Firefox users, it just
> seems get corrupted right away:
> 
> Filer error: Object { name: "EINVAL", code: "EINVAL", errno: 18, message:
> "IndexedDB cannot be accessed. If pr…", stack:
> "e@https://mozillathimblelivepreview…" } bramble.js:3:4004
> 
> We haven't had reports of this in any other browser

Has there been any progress on this? I am seeing the same type of error and only in Firefox.

Comment 16

10 months ago
I just wanted to confirm we've been getting this error for at least a year, probably more, throughout several versions of Firefox.

At one point the indexedDB gets corrupted and any operation on it results in "UnknownError", with no possibility of fixing this. 

Please note that in this kind of situation, _there is no_ "Clear Storage" button available in Page Info.

Comment 17

10 months ago
I forgot to mention that this corrupts IndexedDB for all websites, not just the IndexedDB storage for the particular page...

Comment 18

10 months ago
One last comment, and I apologize for not writing a single one when I was sure I was going to finish. Reading through a couple of other related bugs, I realized in my case this was related to opening Firefox Nightly (to check a fix for an unrelated bug) and going back to the stable Firefox version. 

I.e. my case seems to https://bugzilla.mozilla.org/show_bug.cgi?id=1092090

The solution for this was to go to `about:support` to find my Profile Folder and to delete the contents of the `storage` folder from my profile.

Comment 19

9 months ago
I had this problem for the first time tonight also, and searching for it led me here (from https://bugzilla.mozilla.org/show_bug.cgi?id=944918).

I can confirm this happened after attempting the Firefox Nightly.  

danburzo's workaround to wipe the `storage` folder from the profile seems to have resolved it.

Comment 20

9 months ago
Sorry for the tracker spam, but the above is incorrect ... I found this issue via 1092090.

https://bugzilla.mozilla.org/show_bug.cgi?id=1092090

Possible duplicate.
You need to log in before you can comment on or make changes to this bug.