[Webkit-unassigned] [Bug 200078] New: IndexedDB database dropped

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jul 24 08:33:58 PDT 2019


            Bug ID: 200078
           Summary: IndexedDB database dropped
           Product: WebKit
           Version: Safari 12
          Hardware: iPhone / iPad
                OS: iOS 12
            Status: NEW
          Severity: Critical
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: bertrand at florat.net

Erratically (once or twice a week on each device), the full indexeddb of our website is dropped all together on some users iPhones. I think I can tell it with confidence because the console logs show that the open.onupgradeneeded is triggered with event.oldVersion = 0.

Our PWA stores important professional pictures (insurance) that are regularly uploaded (when online) to a server but -at least once- this problem occurred before the app got a chance to get online and 22 pictures have been lost (this caused us a lot of troubles as you can imagine).

Note : This has only been seen on a couple of iOS safari 12 (iPhone 8) devices, never on Mac OS 10. By lack of logs history, we can't tell if the problem occurred under previous iOS releases.

- User Agent  : Mozilla/5.0 (iPhone; CPU iPhone OS 12_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 Mobile/15E148 Safari/604.1
- The users never cleaned up manually (from Safari settings).
- The device has tens of available GB as seen in General -> Storage
- Our app uses only few tens of MB (less than 50MB)
- The application may be loaded several times in different tabs

My questions :
- What could cause ios safari 12.3 to drop an entire IDB database (beside explicit website data cleanup by users) ?
- Is there specifications about ios safari quotas / eviction ?
    * According to [1], it's 500MB if free space < 1GB and half the free space if free space < 1Go
    * According to [2], it's 50MB
    * According to [3], it's unlimited
    * According to my own tests performed on an iphone 6 / iOS 12.3.1 using the great "Browser Storage Abuser" testing tool [4], there is no problem to fill 500 Mo. I managed to fill 750Mo : some errors occurred (probably due to bug #197050) but the data seems to have been eventually written correctly. Trying to write 1 GB fails, nothing is written down. No eviction (full database deletion) observed.
- Will this behaviour change with iOS 13 ? [see 3] , if so, could it fix our issue in some ways ?


[1] https://trac.webkit.org/changeset/237700/webkit/
[2] https://developers.google.com/web/fundamentals/instant-and-offline/web-storage/offline-for-pwa
[3] https://bugs.webkit.org/show_bug.cgi?id=199614
[4] https://demo.agektmr.com/storage/

My code :
                const open = window.indexedDB.open("DB_X", 8);
                open.onblocked = function (event) {
                        console.error("Database blocked");
                open.onerror = (event) => {
                        console.error('Error opening IndexedDB database: ', event.srcElement.error);
                open.onupgradeneeded = (event) => {
                        db = event.target.result;
                        console.info("Upgrade from version : " + event.oldVersion);
                        if (!event.oldVersion) {
                                db.createObjectStore(NOM_STORE_DOSSIERS, { keyPath: "id" });
                                db.createObjectStore(NOM_STORE_TACHES, { keyPath: "id" });
                                let storeBinaires = db.createObjectStore(NOM_STORE_BINAIRES, { keyPath: "id" });
                                storeBinaires.createIndex("idDossier", "idDossier", { unique: false });
                open.onsuccess = (event) => {
                        console.info("Database opened");
                        db = event.target.result;

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190724/d6ce64f5/attachment.html>

More information about the webkit-unassigned mailing list