ilan-schemoul / meteor-service-worker

An universal service worker for meteor apps
MIT License
137 stars 26 forks source link

Uncaught (in promise) DOMException: Quota exceeded. sw.js:1 #6

Closed tomyo closed 6 years ago

tomyo commented 7 years ago

Using Chrome 54.0.2840.71, sometimes I get this error in console. If I do a Ctrl+Shift+R, the error doesn't show, if then I do a regular refresh, it appears again (sometimes, many times) Is this something to be worried about?

Thanks for this code, the app loads faster now! :)

ilan-schemoul commented 7 years ago

First

Thanks for this code, the app loads faster now! :)

I'm glad about that.

Then quota exceeded probably means that the memory the browser grants by default to a website is exceeded by yours. It probably means that the total size of files SW tries to store in the cache storage is too important. You may want to optimize the size of your assets, you may also want to take a look there because as this article states you may "Ask for a larger storage quota, beyond [the limit of] 5 MB". But please note that as service worker is still relatively new, the quota each browser grants is not standardized yet nor well documented by editors of these browsers so you may have to make specific test or look in SO investigation about quota to be sure that your SW is gonna working on most browsers possible.

tomyo commented 7 years ago

Thanks! BTW, have you considered making this a package? (Just so people can install it with one simple command, and receive updates).

ilan-schemoul commented 7 years ago

I would like making it a package but the scope of the service worker depends, for security reasons, to the folder he has been placed. Meteor's package system allows to add static file but the URL of the static file will be something like /package/meteor-service-worker/sw.js so the scope of the SW will only be URL which starts with /packages/meteor-service-worker so unfortunately, and until Meteor add a way to add file to root (discussion about a proposal to implement web/service workers with Meteor https://github.com/meteor/meteor/issues/6222), no packages can register a working SW. This is a pity and I hope Meteor could improve that a day.

ilan-schemoul commented 7 years ago

So is your problem fixed ? If you fix your problem by reducing the memory the SW is using would you mind sharing how you reduce it ?

tomyo commented 7 years ago

Hi!, I simply ignored the error, because in the console I can see that the page uses 3 MB, If I perform the change in the future, I''l let you know here. Thanks! -- Tomyo.

On Wed, Jan 11, 2017 at 5:59 PM Ilan Schemoul notifications@github.com wrote:

So is your problem fixed ? If you fix your problem by reducing the memory the SW is using would you mind sharing how you reduce it ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/NitroBAY/meteor-service-worker/issues/6#issuecomment-271992416, or mute the thread https://github.com/notifications/unsubscribe-auth/AArP2YkyleZgwVmYZFjppMDo5H590U47ks5rRUKJgaJpZM4LcS5X .

-- Tomás Hayes.

Birowsky commented 7 years ago

@NitroBAY I'm not able to find additional resources.. if it's not memory abuse, what else could cause this message?

ilan-schemoul commented 7 years ago

It is probably lack of memory. In order to develop more complex strategies about caching I'd need to make a package but Meteor doesn't yet offer the ability to make a package register a Service Worker.

capi commented 6 years ago

It seems to me that this issue is happening in Chrome while in Private Browsing Mode (which I tend to use a lot during development). After about 15 or 20 service worker versions are installed (to purge the cache), I get the Quota Exceeded. In a normal browsing window, I don't get it.

So I think it is related to Private Browsing not having a persistent backing store and maybe leaking memory somewhere. As a side-note: Firefox does not offer Service Workers in Private Browsing at all.

I have been testing with a simple shell-script that keeps modifying the sw.js version string every 10 seconds so that a new service worker is installed and caches are recycled. In Private Browsing I get the issue within a few minutes, in normal browsing mode it has now been running for well over an hour without issues.

capi commented 6 years ago

Ok, not entirely true, after about 300 reloads of the service worker in the same tab (Meteor auto-reload on recompile after sw.js is changed), i also get Quota Exceeded. But closing the tab and re-visiting the site "fixed it". Now starting another run to verify.

ilan-schemoul commented 6 years ago

Thanks for sharing these informations, it is interesting.

Cholowao commented 6 years ago

close the issue please @NitroBAY

ilan-schemoul commented 6 years ago

@Cholowao I think it may still happen like in other SW and if I take over this package again I may be trying to found a way around cache overflow

ilan-schemoul commented 6 years ago

Well spamming cache can push limit indefinitely it seems. sw

ilan-schemoul commented 6 years ago

I'm wondering if the fact making the browser use 15gb of the memory is actual a security breach ? Maybe should I report it to Chrome ?

santiagopuentep commented 5 years ago

I'm getting quota exceeded when storing cross origin responses. Chrome seems to put a padding on that kind of response and I'm in over 100 MB with just a few small svgs cached...

AppXprt commented 5 years ago

This storage isn't RAM.. 5GB would imply service worker cache is being stored in local storage.