NEW 235579
iOS 15.2.1 Safari - PWA - An internal error was encountered in the Indexed Database server
https://bugs.webkit.org/show_bug.cgi?id=235579
Summary iOS 15.2.1 Safari - PWA - An internal error was encountered in the Indexed Da...
Jesper Bendtsen
Reported 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?
Attachments
Crash reports (1.13 MB, application/x-zip-compressed)
2022-01-26 05:59 PST, Jesper Bendtsen
no flags
Alexey Proskuryakov
Comment 1 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/
Jesper Bendtsen
Comment 2 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
Alexey Proskuryakov
Comment 3 2022-01-25 11:14:04 PST
That would be "Crash Logs for iOS".
Jesper Bendtsen
Comment 4 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!
Alexey Proskuryakov
Comment 5 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.
Jesper Bendtsen
Comment 6 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.
Radar WebKit Bug Importer
Comment 7 2022-02-01 05:21:18 PST
Jesper Bendtsen
Comment 8 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?
maximecarriere
Comment 9 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
Sihui Liu
Comment 10 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.
Jesper Bendtsen
Comment 11 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?
Anthon Nilsson
Comment 12 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(); -------------------------------
Anthon Nilsson
Comment 13 2022-09-08 04:07:46 PDT
Forgot to say that this never have happened on any android device, only IOS.
Michael
Comment 14 2024-08-20 06:51:45 PDT
(In reply to Anthon Nilsson from comment #12) > 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 https://www.hahagames.com 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(); > ------------------------------- Safari can be a bit finicky with IndexedDB, especially on iOS. Make sure you're using the latest version of localForage—sometimes updates include fixes for these kinds of bugs. Also, you might want to add some more detailed error logging to see if you can spot any patterns or specific conditions that trigger the problem. Safari has some quirks, like closing IndexedDB connections when the app goes into the background, so keeping an eye on those kinds of things might help too. Another thing to consider is how your service worker might be interacting with IndexedDB, especially since your app is a PWA. Sometimes the service worker can cause unexpected behavior. If all else fails, you could implement a fallback strategy where you use localStorage as a backup when IndexedDB fails..
Note You need to log in before you can comment on or make changes to this bug.