Last modified: 2014-10-20 19:44:58 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T66721, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 64721 - mw.loader.store should not occupy all of localStorage
mw.loader.store should not occupy all of localStorage
Status: NEW
Product: MediaWiki
Classification: Unclassified
ResourceLoader (Other open bugs)
1.24rc
All All
: High major with 3 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
:
: 65364 (view as bug list)
Depends on:
Blocks: 42815
  Show dependency treegraph
 
Reported: 2014-05-01 21:55 UTC by Ryan Kaldari
Modified: 2014-10-20 19:44 UTC (History)
13 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Ryan Kaldari 2014-05-01 21:55:39 UTC
In some cases, MediaWikiModuleStore can be quite large (over 1 MB). This can lead to local storage becoming full and causing random problems like bug 64716. According to https://support.mozilla.org/en-US/questions/963825 Firefox shares local storage space across all hosts on a single domain name, so this may be especially problematic for Firefox.

In theory, this shouldn't be an issue since people should always have some sort of fall-back behavior if there are problems with local storage, but in the interests of defensive programming, perhaps we should put a cap on the maximum size of MediaWikiModuleStore.
Comment 1 Ryan Kaldari 2014-05-15 17:55:16 UTC
Any thoughts on this? This bug makes using Wikipedia very annoying for me. Surely I can't be the only person that cares about this.
Comment 2 Ori Livneh 2014-05-21 02:13:20 UTC
(In reply to Ryan Kaldari from comment #1)
> Any thoughts on this? This bug makes using Wikipedia very annoying for me.
> Surely I can't be the only person that cares about this.

This document explains how to clear localStorage:

https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage#Storage_location_and_clearing_the_data

You can also up the quota via about:config. Search for "dom.storage.default_quota" option. Its value is in kilobytes.

I'm not suggesting that these are adequate resolutions for this bug -- they're just workarounds. I want to try something like what DJ is proposing in <https://bugzilla.wikimedia.org/show_bug.cgi?id=65364#c3>.
Comment 3 Krinkle 2014-07-15 20:17:10 UTC
*** Bug 65364 has been marked as a duplicate of this bug. ***
Comment 4 Krinkle 2014-07-15 20:29:30 UTC
Raising priority as this will likely become increasingly more problematic as wikis and extensions register more modules and users enable more features.

mw.loader.store falls back to fetching from the server. However other features that actually use localStorage in a more visible way will lose data in a much worse way (e.g. users unable to store drafts, or a "hide" button not being remembered etc.)
Comment 5 Matthew Flaschen 2014-07-25 02:15:33 UTC
(In reply to Krinkle from comment #4)
> mw.loader.store falls back to fetching from the server. However other
> features that actually use localStorage in a more visible way will lose data
> in a much worse way (e.g. users unable to store drafts, or a "hide" button
> not being remembered etc.)

Yep, as you can see from bug 65566 (thanks for marking that as a see also), we've already had to switch to cookies for a feature due to this issue.
Comment 6 Ryan Kaldari 2014-08-21 18:58:42 UTC
Ori: Any thoughts on this? It's still a significant problem, especially for Firefox users.
Comment 7 Andre Klapper 2014-08-31 21:17:41 UTC
Ori: Could you reply to comment 6 please if you have some ideas?
Comment 8 Michael M. 2014-09-01 07:55:08 UTC
What about this approach?
1. Before saving a module to localStorage try to save a string of 20 KB* there.
2. If this fails, don't save the module in localStorage.
3. If it succeeds, try to save the module.
4. Whether or not putting the module in localStorage succeeds, remove the string from step 1.

This will make sure that the modules never will occupy the last 20 KB* of localStorage.

*) 20 KB is just the first number that came to my mind. Feel free to replace it with any other reasonable number. I have several user scripts that make use of localStorage, they take up 3 KB, but I know users who use them more heavily than me, they probably end up at about 10 KB or more.
Comment 9 Ryan Kaldari 2014-09-08 18:54:50 UTC
Michael M.: That sounds like a good idea, but doesn't solve the underlying issue of this bug (that mw.loader.store takes up too much of localStorage).
Comment 10 Ryan Kaldari 2014-09-08 19:16:35 UTC
Filed an upstream bug against Firefox at https://bugzilla.mozilla.org/show_bug.cgi?id=1064466

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links