Summary: | IndexedDB failing with "UnknownError: Connection to Indexed Database server lost." | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Nisala <nisala> | ||||||
Component: | Website Storage | Assignee: | Nobody <webkit-unassigned> | ||||||
Status: | NEW --- | ||||||||
Severity: | Critical | CC: | ahmad.saleem792, alex, ap, sihui_liu, webkit-bug-importer, zarko | ||||||
Priority: | P2 | Keywords: | InRadar | ||||||
Version: | Safari 17 | ||||||||
Hardware: | iPhone / iPad | ||||||||
OS: | Unspecified | ||||||||
See Also: | https://bugs.webkit.org/show_bug.cgi?id=273827 | ||||||||
Attachments: |
|
Description
Nisala
2024-08-04 14:29:24 PDT
@Nisala - is it possible to attach small reproduction in order to help us understand the problem. All relevant engineers are in CC. I'll try my best to create a reproduction, but I still don't have a good way to reproduce the error consistently. It seems very much up to the whims of iOS. I was hoping that y'all would have a reproduction already from the earlier bug reports of this issue. From what I've seen on Sentry, the bug happens when an app that uses IndexedDB via a Webview (app.getbaseline.baseline, in my case) is put into the background and then re-opened many hours later. When the app is reopened, the database is closed and can't be reopened, and throws the UnknownError. I can confirm this issue as well (user reports, and firsthand) on iOS 17.6. It is seemingly sporadic and I'm unable to reproduce on demand. Created attachment 472314 [details]
zarko - example exception log
See attached example exception log.
It seems like it might also have to with an event where there is no internet connection when the app comes back to foreground.
The exception is close to impossible to reproduce myself. For the time being it's clogging our error reporting system (blowing up our quota) and it's not clear what kind of runtime effect it has for users.
Given that the error message says "Connection to Indexed Database server lost. Refresh the page to try again", is it even worth trying to reload the (web) app? Would that recover the IndexedDB database/connection?
If it may help, I can inform that we're using https://www.npmjs.com/package/idb-keyval, which works well until things go south with the IndexedDb and read/write operations starts to fail silently. I made an attempt there with a pull request ("Try to reopen database in case of unexpected closure" - https://github.com/jakearchibald/idb-keyval/pull/175) but the library project doesn't seem to well maintained... I believe Dexie.js and Firebase have similar recovery logic in place, though it is probably only a partial solution - not enough if the db cannot be re-opened at all within the session. |