WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
200078
IndexedDB database dropped
https://bugs.webkit.org/show_bug.cgi?id=200078
Summary
IndexedDB database dropped
bertrand
Reported
2019-07-24 08:33:58 PDT
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 ? Thanks [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; } }
Attachments
Add attachment
proposed patch, testcase, etc.
bertrand
Comment 1
2019-08-09 14:36:03 PDT
4 more pictures lost today and IDB purged 4 times this afternoon on the same iPhone 8 ! Any insight ? We are in a very bad situation with our customer as it seems that their data can be dropped at any time... Thanks for your help...
bertrand
Comment 2
2019-12-27 11:47:12 PST
I close this for now. No more cases since ios 13.
Radar WebKit Bug Importer
Comment 3
2019-12-27 11:48:16 PST
<
rdar://problem/58219784
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug