Bug 235579 - iOS 15.2.1 Safari - PWA - An internal error was encountered in the Indexed Database server
Summary: iOS 15.2.1 Safari - PWA - An internal error was encountered in the Indexed Da...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Website Storage (show other bugs)
Version: Safari 15
Hardware: iPhone / iPad iOS 15
: P2 Critical
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-01-25 05:21 PST by Jesper Bendtsen
Modified: 2023-07-14 15:11 PDT (History)
8 users (show)

See Also:


Attachments
Crash reports (1.13 MB, application/x-zip-compressed)
2022-01-26 05:59 PST, Jesper Bendtsen
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jesper Bendtsen 2022-01-25 05:21:01 PST
Every day my IOS users get this error in Safari (IOS 15.2.1).

Uncaught (in promise): UnknownError: An internal error was encountered in the Indexed Database server

Subsequent:

Uncaught (in promise): UnknownError: Connection to Indexed Database server lost. Refresh the page to try again

Has to reload the page everytime to get it back :(

It's a standalone PWA builded with Angular 13, using localForage for writing to Safari IndexedDB

I cannot find any pattern in it, can even reproduce it my self, it just happens all of a sudden...

Please help?
Comment 1 Alexey Proskuryakov 2022-01-25 10:28:04 PST
If you can find a crash log associated with this happening, please attach it to this bug. Instructions can be found at https://developer.apple.com/bug-reporting/profiles-and-logs/
Comment 2 Jesper Bendtsen 2022-01-25 11:00:35 PST
I want to help as much as possible with this error. But which instruction should I pick for iOS Safari IndexedDB? https://developer.apple.com/bug-reporting/profiles-and-logs/?platform=ios
Comment 3 Alexey Proskuryakov 2022-01-25 11:14:04 PST
That would be "Crash Logs for iOS".
Comment 4 Jesper Bendtsen 2022-01-26 05:59:36 PST
Created attachment 450014 [details]
Crash reports

Thanks step "3. Click Sync in the bottom right corner of the window." I could not find in Windows 10. 

But I find som logs on the iPad device in analysis data, I hope it's the same? 

Some users say it happens when there go out of the app and back in later!
Comment 5 Alexey Proskuryakov 2022-01-26 11:06:36 PST
I don't see anything standing out as a smoking gun to me in these logs, unfortunately. Added some more folks who could have suggestions on how to investigate this.
Comment 6 Jesper Bendtsen 2022-01-28 06:13:25 PST
I'm not 100% sure yet, but it seems that my iOS users now are getting the error "Attempt to iterate a cursor that doesn't exist", instead of "An internal error was encountered in the Indexed Database server" after installing iOS 15.3! Maybe I can do something about this error instead of reloading the page? The error occurs when they exit the app and return later.
Comment 7 Radar WebKit Bug Importer 2022-02-01 05:21:18 PST
<rdar://problem/88323466>
Comment 8 Jesper Bendtsen 2022-02-11 07:58:07 PST
My users still get this error "Connection to Indexed Database server lost. Refresh the page to try again" in iOS 15.3. Please tell me what to do to get a more detailed log?
Comment 9 maximecarriere 2022-02-11 08:13:20 PST
We also started having that exact error message "Connection to Indexed Database server lost. Refresh the page to try again". We also seem to have higher memory usage and crashes with "highwater" as the reason
Comment 10 Sihui Liu 2022-02-11 13:09:23 PST
The connection error can happen when WebKit's networking process crashes/gets killed during IndexedDB operations (it's not necessarily an IndexedDB bug but process exits so the operation cannot finish).

If you can reproduce the issue or see the issue on your device, can you check if you have files on your device with name com.apple.WebKit.Networking?

For the cursor error, does it also happen when users background Safari too? 

WebKit may actively abort an IDB transaction when process is backgrounded. A transaction can run in background until system finally decides to suspend the process, and the transaction will be rolled back (since a process cannot hold lock to a database when it's suspended). You may set onabort listener on IDBTransaction and see if the transaction gets aborted when the cursor error happens. If so, maybe try breaking down long-running transactions to smaller ones, so it has a chance to finish before timeout, and it may be easier to retry even if it's aborted.
Comment 11 Jesper Bendtsen 2022-04-29 05:15:14 PDT
For more than two weeks ago, I changed the libary "Localforage" to "idb" which is used to communicate with IndexedDB and my users also updated iOS to 15.4.1, since then we have not seen the error!!! :) Is it "Idb" or is it you guys who has done some magic?
Comment 12 Anthon Nilsson 2022-09-08 04:04:13 PDT
My users get this messages often when the code for using Dexie.js is used in the application. The application is written in Angular 14.

Here is some of the information from the browser error.

-- UserAgent:
-------------------------------
Mozilla/5.0 (iPhone; CPU iPhone OS 15_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6.1 Mobile/15E148 Safari/604.1
-------------------------------

Error message (it is actually repeating itself in the same message, might be becauce something in dexie):
-------------------------------
Uncaught (in promise): DatabaseClosedError: UnknownError Connection to Indexed Database server lost. Refresh the page to try again
 UnknownError: Connection to Indexed Database server lost. Refresh the page to try again
DatabaseClosedError: UnknownError Connection to Indexed Database server lost. Refresh the page to try again
 UnknownError: Connection to Indexed Database server lost. Refresh the page to try again
-------------------------------

-- Stacktrace (deminified) (dont know if it is helpful):
-------------------------------
(webpack:///node_modules/zone.js/fesm2015/zone.js:1212:65) func: z, code: (value && value.stack ? '\n' + value.stack : ''));
(webpack:///node_modules/zone.js/fesm2015/zone.js:1138:23) func: , code: const TYPE_ERROR = 'Promise resolved with itself';
(webpack:///node_modules/zone.js/fesm2015/zone.js:1154:19) func: , code: catch (err) {
(webpack:///node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js:32:0) func: a, code: _next(undefined);
(webpack:///node_modules/@babel/runtime/helpers/esm/objectSpread2.js:4:0) func: S, code: var keys = Object.keys(object);
(webpack:///packages/core/src/zone/ng_zone.ts:413:35) func: onInvoke, code: 
(webpack:///node_modules/zone.js/fesm2015/zone.js:134:49) func: run, code: return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source);
(webpack:///node_modules/zone.js/fesm2015/zone.js:1294:43) func: , code: return resolvePromise(new this(null), RESOLVED, value);
(webpack:///packages/core/src/zone/ng_zone.ts:398:39) func: onInvokeTask, code: 
(webpack:///node_modules/zone.js/fesm2015/zone.js:178:57) func: runTask, code: return this._zoneDelegate.invokeTask(this, task, applyThis, applyArgs);
(webpack:///node_modules/zone.js/fesm2015/zone.js:585:42) func: _, code: task.zone.runTask(task, null, null);
(webpack:///node_modules/zone.js/fesm2015/zone.js:491:20) func: invokeTask, code: drainMicroTaskQueue();
-------------------------------
Comment 13 Anthon Nilsson 2022-09-08 04:07:46 PDT
Forgot to say that this never have happened on any android device, only IOS.