Page MenuHomePhabricator

mw.loader (with wgResourceLoaderStorageEnabled) fills up localStorage, preventing persistent writes by other code
Closed, DuplicatePublic

Description

Right now, if I try to visit any page on English Wikipedia, I get a JS exception thrown:
[Exception... "Persistent storage maximum size reached" code: "1014" nsresult: "0x805303f6 (NS_ERROR_DOM_QUOTA_REACHED)" location: "<unknown>"]
This is despite the fact that I currently have nothing in localStorage for English Wikipedia and my localStorage quota is set to the default (5 MB).

I think what's going on is that Firefox is sharing localStorage space across all wikipedia.org sites, and since I have several ~1 MB MediaWikiModuleStores from other Wikipedias, it doesn't have room to store one for en.wiki. See https://support.mozilla.org/en-US/questions/963825 for someone else who noticed the same problem in Firefox but for a different website.

One possible semi-solution to this bug is discussed in bug 64721. Even if the size of MediaWikiModuleStore was reduced, however, you could still run into this problem if you visit enough Wikipedias.


Version: 1.24rc
Severity: major

Details

Reference
bz65364

Related Objects

Duplicates Merged Here
T67649: Storage errors

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 3:14 AM
bzimport added a project: MediaWiki-JavaScript.
bzimport set Reference to bz65364.
bzimport added a subscriber: Unknown Object (MLST).
kaldari created this task.May 15 2014, 7:22 PM
ori added a comment.May 15 2014, 7:24 PM

Thanks for the report. Apart from the error in the console, does JavaScript break?

Javascript still seems to be working. For example, I can click the watchlist star and it functions as normal.

@ori, we should really move this into indexedDB, which has much bigger quota's.

We should have like a mw.storage.bigData (indexeddb with fallback to localStorage) and a mw.storage.smallData (localStorage with fallback to cookies (for wikieditor/collapsedstate of widgets etc).

For context, testing by Rob and I (my testing was in Firefox) showed that it will still let you write after the storage fills up, but it is not guaranteed to be persistent.

So in an over quota scenario, $.jStorage.set (for example) will not throw, but on reload the data is gone.

I think this is what the error means exactly. I.E. you can still call the localStorage API, but it is no longer *persistent* storage.

ori added a comment.May 21 2014, 2:14 AM

(In reply to Derk-Jan Hartman from comment #3)

@ori, we should really move this into indexedDB, which has much bigger
quota's.
We should have like a mw.storage.bigData (indexeddb with fallback to
localStorage) and a mw.storage.smallData (localStorage with fallback to
cookies (for wikieditor/collapsedstate of widgets etc).

Yeah, I think that's right. I'll research this a bit.

I think this is what the error means exactly. I.E. you can still call the
localStorage API, but it is no longer *persistent* storage.

I was wrong before. The browser did not have this behavior of letting localStorage work, but non-persistently. Rather, this is part of jStorage's behavior. It first writes it to in-memory (as Ori said), then attempts to save but suppresses any error (https://git.wikimedia.org/blob/mediawiki%2Fcore.git/ee5b96fe5df3bfdbc811259230d2f3da7e4ff1b6/resources%2Flib%2Fjquery%2Fjquery.jStorage.js#L444).

Related, if it can't save its test on initialization, localStorageReallyWorks will be false and it will fall back. On a modern browser (i.e. no globalStorage or userData), this means it will be purely in-memory ($.jStorage.currentBackend() will be false)

Disclaimer: I was using a lower version of Firefox before (I actually upgraded to Firefox 29.0.1 so I could get it to stop on caught exceptions), but I'm pretty certain it was jStorage catching the error in both cases.

Matthew Flaschen: That sounds right. When I was getting the localStorage full exception being thrown, it wasn't storing anything in localStorage, even temporarily.

Ori: Looks like the IndexedDB quotas are as follows:
Firefox: 50MB soft limit, asks for permission after that
Chrome: 10% of available disk space
Explorer: 10MB soft limit, asks for permission after that. 250MB per domain hard limit.

  • Bug 65649 has been marked as a duplicate of this bug. ***

Is there any way I can disable the MW feature which keeps using the storage to avoid this warning every time I debug a script in any WMF wiki?

"Storage error" load.php:161
"[Exception... "Persistent storage maximum size reached" code: "1014" nsresult: "0x805303f6 (NS_ERROR_DOM_QUOTA_REACHED)" location: "<unknown>"]" DOMException [NS_ERROR_DOM_QUOTA_REACHED: "Persistent storage maximum size reached"
code: 1014
nsresult: 0x805303f6
location: https://bits.wikimedia.org/en.wikipedia.org/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki%2CSpinner%7Cjquery.triggerQueueCallback%2CloadingSpinner%2CmwEmbedUtil%7Cmw.MwEmbedSupport&only=scripts&skin=vector&version=20140706T172507Z:183]

hoo added a comment.Jul 10 2014, 8:26 AM

(In reply to Helder from comment #9)

Is there any way I can disable the MW feature which keeps using the storage
to avoid this warning every time I debug a script in any WMF wiki?

No... only thing you can try is disabling your localstorage entirely (not sure how that's handled in MW)

  • This bug has been marked as a duplicate of bug 64721 ***