New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Endless reaload after re-deployment #5769
Comments
I've got a similar issue, however I did not do any code or package changes - instead my host had to migrate my virtual instance to another node so I had to take the site down for a brief moment. When I started the Meteor app again it is now stuck in an infinite reload loop. I do not have the appcache package, I do use Nginx and I haven't made any configuration changes at all. It was running perfectly fine before the migration. All other meteor apps this instance hosts runs perfectly fine except one. This do not happen locally in development, only in production. There hasn't been any changes to the code or nginx configuration at all - this "just happened". No errors in the logs on the server, no errors in Chrome's console (just deprecation warnings). No HTTP error status codes either, Meteor DDP Monitor reports that it's able to open a WebSocket connection to the server, subscriptions works as well. Cache is off. My package list:
|
which version of node.js do you use? |
@limbit v0.10.40, you? |
v0.10.41 (current revision). Anyway you should update your node.js because of several security issues. Did you try to clean the cache before re-deployment? Anyway, it works for us after removing the appcache package. This is why i think it is a meteor issue. |
Yeah cache is off (not using appcache package though). Checking the DDP monitor says that the client has to be updated (although very hard to spot due to the reloads). Looks like an issue with the autoupdate package (webapp). I'll try to grab a screenshot. Was going to upgrade node after the migration, but ran into this and wanted to fix this issue first though. EDIT: |
you could try to deploy a debugable version: meteor build ../build --server=xxxx --debug During debugging we saw that the autoupdate package and the reload package produce the recursion but without any solution yet. |
@limbit do you use PM2? I managed to fix the issue by not using PM2 at all - atm I've got a temporary fix in place where I simply run |
@Svenskunganka we didn't use PM2 but it looks great. We still get the endless reload and i hope to get some help from the meteor-team soon. |
Does anyone else have any idea? Thanks |
compared to the working hot-pushes it does not download the current state. Perhaps this is the cause for the endless reloading. window.applicationCache.update() does not trigger downloading also. |
Hi @limbit, It's difficult to debug this issue without a simple reproduction we can play with. Please provide a full reproduction as described in: https://github.com/meteor/meteor/wiki/Contributing-to-Meteor#reporting-a-bug-in-meteor If you figure out more specifics about what the problem is, please open a new ticket or ping me and we'll reopen this one. |
We are seeing the same appcache infinite-reload bug @limbit describes. I don't have a repro to share. If get one I will. Not all re-deploys are affected, and we think the bug may occur or not-occur based on the elapsed time since most recent re-deployment. We're still trying to figure out exactly the circumstances. In the meanwhile, here is the work-around we are using: We modify the appcache module to briefly return 404s for appcache.manifest for any IP which has requested a manifest more than 3 times in the past minute. When the bug strikes, an affected client fetches the manifest repeatedly until it hits the 404 error, then quickly falls back to non-cache loading. (Interestingly, this takes 2-3 404s, but it does work.) The next time the client loads it gets a normal manifest again and correctly loads the (latest) cache bundle and the cache is active again until the next time the bug strikes. Not ideal, particularly if you had many users behind a proxy (we don't), but it rescues users from the infinite-reload loop and lets us continue to use appcache for offline operation. The code added to appcache-server.js looks like this:
|
I am currently having the same issue with GroundDB |
Same issue here. Only difference is I am using Ubuntu's Upstart but it doesn't seem to be an issue caused by that. Meteor goes into a refresh loop for about 3-5 minutes, refreshing every 2 seconds - which is really bad for my visitors. |
My app was infinitely reloading under 1.3 / Ubuntu + Upstart. I was running it behind NGINX and had enabled caching in NGINX. When I turned off caching the problem went away. Posting this in case it helps anybody here debug their situation. |
Thanks for sharing @shilman that was happening in a project and we solved it with It was hurting us really bad. I'm very surprised, in the worst possible way, that this directive is not recommended in the article about setting up Meteor on nginx http://www.meteorpedia.com/read/nginx so I've just added it. |
Surely having a no_cache policy on the entire app isn't the best approach here? I used the following, which fixed the redirect loop because the document page that has the refs to the js etc must not be cached but those static files referenced can be.
|
@justingrayston since your regex has |
@sebastianconcept doesn't the html document reload have the references to the new JS? |
@justingrayston I'm not sure but sounds like it is worth trying |
@justingrayston |
@sebastianconcept It was working for me in staging and local. Where did you place it exactly? I am in the midst of feeding 4 kids ATM but I will have a look later and paste my working config. |
@sebastianconcept You are right, you get a redirect loop with JS and mashed styling when you have css in there too. I wonder if there was a 1.3 change to how this works? I am sure this worked on an older meteor app. When I have created non meteor apps with a client that is deployment aware, the way I model it, is that the JS is notified (by polling, web socket or service worker) that a new version is available and that triggers a reload that has a cache break url that the client will then remove once loading the new document, that then has references to all the new static js and css. This means you can cache the JS for the app for a long time, saving on bandwidth, which adds up at scale. Works a treat, and I made the terrible mistake of seeing a similarity in how meteor seemed to do it. Apologies. This is my nginx config that I have tested a little this evening and seems to work when running
I still stand by what I said, that a blanket no cache rule isn't good for bandwidth costs at scale. I just wish that you could cache JS and CSS for long periods. @tmeasday are we way off here, have we missed something, should we be able to cache those assets? Please feel free to pick over and amend, just let me know :) |
Are we still talking about an issue with appcache and endless reload? @justingrayston I think in general it's not a good idea to change caching headers in a proxy layer. The Meteor server is the one that should decide if the resource can be cached. In the case of Meteor the URL of JS+CSS assets changes within the boilerplate HTML when you deploy a new version, so meteor serves a long-lived Infinite reload loops sound like issues with the old boilerplate being cached (either by the proxy, or perhaps the browser in the appcache case) when it should not be. |
Yup we are.
That fits with what I was thinking. So really we should add neither caching or no_cache rules. Meteor will take care of it. Testing now, and thanks for the response! I will confirm all is good. |
Confirmed. I see good long cache headers on the JS and CSS when removing everything from nginx. Reloads work just fine. This is why it worked on the other project that isn't upgraded to 1.3, I just checked the config and it doesn't do anything to the cache. Thanks @tmeasday Phew.
|
@tmeasday just to let you know I was having the reloads while |
@sebastianconcept I haven't added appcache, so when I said
above, I wasn't exactly correct. The app I was having issue was pretty vanilla. Without any cache declaration in the nginx proxy it now works just fine. |
@justingrayston sure, np. Thanks for sharing |
@sebastianconcept @justingrayston @tmeasday I'm also having a reloading loop problem. It seems like this thread recommends to remove nginx caching. Somehow my configs had this:
And what I understand is to remove the last commented part because Meteor does this itself. The above commit also includes this at the bottom of of the location directive:
My understanding is this would add alot of traffic to the server. Is it necessary to resolve the reloading issue? For me, redirect issues started around 1.3. Is there an nginx config guide for 1.3? Thanks! |
Yes remove both, the expires and the no cache header, just let nginx proxy and leave cache headers to Meteor. Works fine with the config I posted. |
FYI: This thread deals with the same problem https://forums.meteor.com/t/app-constantly-refreshing-after-an-update/23586/112 Disabling any caching related stuff, especially
made it work, thanks a lot! This is my working location block:
|
If you are using meteor app cluster, make sure you add Example :
|
Update: We appear to have solved our instance of the endless-reload appcache problem. Given this has been going on for years with no solution in sight, and given intent to fix even seems waning, I hope it may work for others. Even if appcache is eventually going away, the transition will take years and we want to continue to use it during the transition. The inspiration was pauldulong's comment about onMigration in the Meteor forums thread [App constantly refreshing after an update](https://forums.meteor.com/t/app-constantly-refreshing-after-an-update/23586/142]. We weren't doing any of the caching that has caused (some) others' instances of this problem. Instead, Meteor appears to be reloading from the moment it determines a code refresh is needed, long before the appcache has had a chance to update. To prevent that, we hook Meteor's onMigrate interface to control when reloads can happen, and monitor window.applicationCache events/status to get the timing correct for the one reload we do eventually need. I'm including a simplified-but-complete version below. (Note that some have reported success with just returning false from their onMigration callback, but that didn't work for us.) Although our experience so far is limited, we appear to be seeing reliable single-reload appcache updates now.
|
FWIW, this piece of code stopped my app from reloading infinitely. add it to
|
this should be re-opened.... |
Agree with @chrisbutler - we have been using @introrse 's solution above for a long while now, sometimes we are able to remove it for a short time, but generally on the next deploy the issue will begin happening again. The app is only on screen for about 2 seconds before the reload happens, in an endless loop. Here is our package list:
|
I had the same problem. Cause: On deploy, mup.js file was dynamically created in the root of the app for instances with different port and it was counted as part of the app. That's why autoupdateVersion was different. Solution: Do mup deploy from a directory which are not loaded as part of your app code. For example, i've created I suppose some people had the same scenario. |
We discovered a serious problem when using appcache and we didnt found a solution yet:
when we are using appcache, the app gets into a infinite reloading after a re-deployment on our server.
A detailed description can be found here: http://stackoverflow.com/questions/31764488/meteor-reloads-endlessly-after-re-deployment-on-server-with-appcache
packages
This will keep us from publishing it on our server for the customers. Does anyone know how to solve it?
The cache even doesnt reload the new data into the cache. Whats wrong there?
The text was updated successfully, but these errors were encountered: