App constantly refreshing after an update

Are you using Nginx with Galaxy? (I’ve never used it myself)

(In other news, our site went extra viral tonight, and massively frustrating that I can’t make an update due to this infinite refresh bug :pensive:)

I’m using the default nginx.conf file. Doesn’t seem to have a Cache-Control or Expires line in it

@elie I created a HAR archive from Chrome with my site refresh-looping and sent it to @abernix. Maybe you should do the same and send to him, see if we can get any wiser…

Go into Chrome, open developer tools / network tab, get the refresh loop going, click preserve log, let it loop for a few times, then stop it (I have to kill my server to get it to stop). Right click in the network tab and choose save as HAR with content.

I don’t know what the “default nginx.conf” is, but that’s probably going to need to be changed in some way to work with Meteor, especially if you’re double proxying – which means you’re actually involving three servers. This is a complicated setup.

At the very least I hope you’re using X-Forwarded-For $proxy_add_x_forwarded_for and X-Forwarded-Proto if you’re using https. And if you want the correct remoteAddr (client address) to make it to your Meteor server, you’ll likely have to start Meteor with HTTP_FORWARDED_COUNT set to 1, so the correct client address makes it downstream. But in addition to that there are keep-alive values, connection upgrade headers and more that need to be set (and passed along!)

Please try eliminating one of the levels of proxying. There is no need for you to proxy: nginx > nginx > meteor.

For whatever reason the Chrome/Canary DevTools “Save as HAR” has a hard time with connections that are not finished. Using FireFox should prevent you from having to kill your server. However, I’m about to go on holiday for a couple weeks, so don’t e-mail me more HAR files and expect a response anytime soon. :wink:

The other reason is, unfortunately, I didn’t see anything in @jesperwe’s HAR that screamed out at me. It appears the WebSocket was upgraded successfully and the reload happened shortly after. But there could easily be multiple issues at play here:

  • cache headers being mangled (like this issue)
  • SSL redirects gone loopy
  • sessions not sticking to a single server and thus websockets “hunting” around
  • etc., etc.

To isolate the problem(s) in each case, my propositions to those experiencing this are:

  • Eliminate your own app (and its dependencies!) by trying to deploy with the default app created by meteor create
  • Eliminate your own proxy config by using a common and known-to-work setup (mupx, not mup) on a fresh VirtualBox/DigitalOcean/etc.
  • Deploy the same app to Galaxy. It’s relatively inexpensive to deploy for long enough to debug – though you will need a MongoDB account with compose.io, etc.
  • Since it seems to be a possibility, if you’re deploying to a directory (i.e. ROOT_URL=http://domain.com/subdirectory) try deploying to the top level domain.
  • If you’re using force-ssl and you’re trying to enforce SSL at your proxy level, try getting rid of force-ssl in your Meteor app. If you’re not passing X-Forwarded-* headers through the proxy properly, this can cause redirects.
  • Throw a debugger; line into your client code, open DevTools and load your site. Then try stepping through until the redirect happens and figure out if it’s perhaps some JavaScript doing it.

Just some ideas. Hope they help!

By default nginx.conf file I meant:


that sits in a place such as /etc/nginx/nginx.conf.

The specific nginx config for that acts as a load balancer and takes care of SSL as well sits in the sites-available folder.

The reason nginx > nginx > meteor is happening is because MUPX uses nginx, but we also need a load balancer in front of it all.

Just seen your latest response. Will have a deeper look soon. Thanks a lot for the help.

I’m aware, but the default /etc/nginx/nginx.conf file does not configure anything properly for a load-balancer or a proxy and definitely not Meteor. It is is setup to serve a static directory of html content with an index.html file as a directory index (e.g. served at /).

If you have additional files in sites-available that extend the configuration, then those are part of the configuration too. I would expect to have something similar to this.

Is anyone here using Cloudfront or another CDN with their app and experiencing infinite refreshes? (I am not, but would like to move to using a CDN now).

1 Like

I am using Cloudflare => Nginx reverse proxy => Meteor. I have experienced infinite refreshes (as mentioned above) but it’s intermittent. I suspect it’s unrelated to the CDN and is more related to my NGINX instance…

Okay. I thought using the CDN might help. And interesting that you’re not
doing nginx > nginx > Meteor. That isn’t the problem then. Going to try
work through some of the suggestions here now.

Again, my set up is a very simple dedicated server with one instance only and nginx in front, now configured according to all the advice from @abernix. Still looping.

So it is very possible to trigger the error without clustering or complex setups.

I was thinking maybe we should compare packages, to see if we can see some common package that could be the culprit.

I have .meteor/packages:

accounts-facebook
accounts-google
accounts-password
accounts-twitter
accounts-ui
alanning:roles
aldeed:geocoder
arillo:flow-router-helpers
aslagle:reactive-table
cfs:s3
cfs:standard-packages
cfs:ui
ecmascript              # Enable ECMAScript2015+ syntax in app code
edgee:slingshot
email
es5-shim                # ECMAScript 5 compatibility for older browsers.
facts
flawless:meteor-toastr
fortawesome:fontawesome
gadicohen:headers
http
huttonr:bootstrap3
jagi:astronomy
jagi:astronomy-validators
jcbernack:reactive-aggregate
kadira:blaze-layout
kadira:dochead
kadira:flow-router
less
mdg:geolocation
meteor-base             # Packages every Meteor app needs to have
meteorhacks:picker
mobile-experience       # Packages for a great mobile UX
monbro:mongodb-mapreduce-aggregation
mongo                   # The database Meteor supports right now
patrickml:braintree
peerlibrary:blaze-components
peerlibrary:reactive-field
random
reactive-var
risul:bootstrap-colorpicker
sacha:spin
service-configuration
session                 # Client-side reactive dictionary for your app
sha
standard-minifier-css
standard-minifier-js
tap:i18n
tap:i18n-ui
thinksoftware:image-resize-client
tmeasday:acceptance-test-driver
tracker                 # Meteor's client-side reactive programming library
useraccounts:bootstrap
useraccounts:core
useraccounts:flow-routing
vsivsi:job-collection

And the ones I’ve migrated to NPM so far:

"bootstrap-datepicker": "^1.6.0",
"bootstrap-dialog": "^1.34.6",
"bootstrap-select": "^1.10.0",
"d3": "^3.5.16",
"desandro-classie": "^1.0.1",
"desandro-get-style-property": "^1.0.4",
"desandro-matches-selector": "^2.0.1",
"doc-ready": "^1.0.3",
"eventie": "^1.0.6",
"fizzy-ui-utils": "^2.0.1",
"flickity": "^1.2.1",
"flickity-imagesloaded": "^1.0.4",
"get-size": "^2.0.2",
"hammer-timejs": "^1.1.0",
"hammerjs": "^2.0.8",
"imagesloaded": "^4.1.0",
"intro.js": "^2.1.0",
"jquery": "^2.2.3",
"jquery-hammerjs": "^2.0.0",
"jquery.cookie": "^1.4.1",
"json-2-csv": "^2.0.21",
"moment": "^2.13.0",
"notifyjs": "^1.3.0",
"nvd3": "^1.8.3",
"string": "^3.3.1",
"tap-listener": "^1.1.2",
"unidragger": "^2.1.0",
"unipointer": "^2.1.0",
"wolfy87-eventemitter": "^4.3.0"

I think we already established that it is not FlowRouter, but see if you can spot other similarities in your setups maybe?

Interesting how little overlap we have :slight_smile:

Anyway here are my packages:

standard-app-packages
accounts-password
http
email
#accounts-facebook
sacha:spin
dburles:collection-helpers
meteorhacks:fast-render
less
mrt:planet
raix:handlebar-helpers
iron:router
meteorhacks:subs-manager
natestrauser:connection-banner
meteorhacks:npm


mrt:cron-tick
mrt:jquery-ui-sortable
mizzao:timesync
pfafman:font-awesome-4
accounts-ui
nemo64:bootstrap
facts

reactive-var
yogiben:pretty-email
alanning:roles
chrismbeckett:toastr
fastclick
reywood:publish-composite
aldeed:autoform
aldeed:simple-schema
aldeed:collection2
mrt:moment
meteorhacks:kadira
notifications
meteorhacks:unblock
peppelg:bootstrap-3-modal
raix:push@3.0.2
aldeed:template-extension
okgrow:analytics
useraccounts:bootstrap
accounts-google
service-configuration
particle4dev:cordova-fb
elie:referrals
kadira:debug
tmeasday:publish-counts
underscore
meteorhacks:kadira-profiler
konecty:multiple-instances-status
joshowens:shareit
konecty:user-presence
useraccounts:iron-routing


npm-container
zimme:active-route
ddp-rate-limiter
ecmascript
elie:ad-manager
meteortoys:allthings
lookback:emails
wylio:winston-papertrail
manuelschoebel:ms-seo
fongandrew:find-and-modify
zenorocha:clipboard
useraccounts:core
benjick:telegram-bot
biasport:facebook-sdk
gadicohen:robots-txt
gadicohen:sitemaps
standard-minifier-css
standard-minifier-js
meteorhacks:aggregate
reload-safetybelt

And:

accounts-base@1.2.7
accounts-google@1.0.9
accounts-oauth@1.1.12
accounts-password@1.1.8
accounts-ui@1.1.9
accounts-ui-unstyled@1.1.12
alanning:roles@1.2.15
aldeed:autoform@5.8.1
aldeed:collection2@2.9.1
aldeed:collection2-core@1.1.1
aldeed:delete-button@2.0.0
aldeed:schema-deny@1.0.1
aldeed:schema-index@1.0.1
aldeed:simple-schema@1.5.3
aldeed:template-extension@3.4.3
allow-deny@1.0.4
autoupdate@1.2.9
babel-compiler@6.6.4
babel-runtime@0.1.8
base64@1.0.8
benjick:telegram-bot@1.3.2
biasport:facebook-sdk@0.2.3
binary-heap@1.0.8
blaze@2.1.7
blaze-tools@1.0.8
boilerplate-generator@1.0.8
caching-compiler@1.0.4
caching-html-compiler@1.0.6
callback-hook@1.0.8
check@1.2.1
chrismbeckett:toastr@2.1.2_1
chuangbo:cookie@1.1.0
cmather:handlebars-server@2.0.0
coffeescript@1.0.17
cosmos:browserify@0.4.0
dburles:collection-helpers@1.0.4
dburles:mongo-collection-instances@0.3.4
ddp@1.2.5
ddp-client@1.2.7
ddp-common@1.2.5
ddp-rate-limiter@1.0.4
ddp-server@1.2.6
deps@1.0.12
diff-sequence@1.0.5
ecmascript@0.4.3
ecmascript-runtime@0.2.10
ejson@1.0.11
elie:ad-manager@1.2.3
elie:referrals@0.2.0
email@1.0.12
facebook@1.2.6
facts@1.0.8
fastclick@1.0.11
fongandrew:find-and-modify@0.2.2
gadicohen:robots-txt@0.0.10
gadicohen:sitemaps@0.0.24
geojson-utils@1.0.8
google@1.1.11
gwendall:body-events@0.1.6
handlebars@1.0.7
html-tools@1.0.9
htmljs@1.0.9
http@1.1.5
id-map@1.0.7
iron:controller@1.0.12
iron:core@1.0.11
iron:dynamic-template@1.0.12
iron:layout@1.0.12
iron:location@1.0.11
iron:middleware-stack@1.1.0
iron:router@1.0.12
iron:url@1.0.11
joshowens:shareit@1.0.2
jquery@1.11.8
kadira:debug@2.2.4
konecty:multiple-instances-status@1.0.6
konecty:user-presence@1.2.8
lai:collection-extensions@0.1.4
launch-screen@1.0.11
less@2.6.0
livedata@1.0.18
localstorage@1.0.9
logging@1.0.12
lookback:emails@0.7.3
manuelschoebel:ms-seo@0.4.1
matb33:collection-hooks@0.7.15
mdg:validated-method@0.2.3
mdg:validation-error@0.2.0
meteor@1.1.14
meteor-platform@1.2.6
meteorhacks:aggregate@1.3.0
meteorhacks:async@1.0.0
meteorhacks:collection-utils@1.2.0
meteorhacks:fast-render@2.14.0
meteorhacks:inject-data@2.0.0
meteorhacks:kadira@2.28.7
meteorhacks:kadira-binary-deps@1.4.0
meteorhacks:kadira-profiler@1.2.1
meteorhacks:meteorx@1.4.1
meteorhacks:npm@1.5.0
meteorhacks:picker@1.0.3
meteorhacks:ssr@2.2.0
meteorhacks:subs-manager@1.6.4
meteorhacks:unblock@1.1.0
meteortoys:allthings@2.3.1
meteortoys:authenticate@2.1.0
meteortoys:autopub@2.1.0
meteortoys:blueprint@2.1.0
meteortoys:email@2.1.0
meteortoys:hotreload@2.1.0
meteortoys:listen@2.1.0
meteortoys:method@3.0.4
meteortoys:pub@3.0.4
meteortoys:result@2.1.0
meteortoys:shell@2.1.0
meteortoys:status@2.1.0
meteortoys:sub@2.1.0
meteortoys:throttle@2.1.0
meteortoys:toykit@2.2.1
minifier-css@1.1.11
minifier-js@1.1.11
minimongo@1.0.16
mizzao:timesync@0.4.0
mobile-status-bar@1.0.12
modules@0.6.1
modules-runtime@0.6.3
momentjs:moment@2.10.6
mongo@1.1.7
mongo-id@1.0.4
mongo-livedata@1.0.12
mrt:cron-tick@0.0.4
mrt:jquery-ui-sortable@1.10.3
mrt:moment@2.8.1
mrt:planet@0.2.2
msavin:jetsetter@1.5.2
msavin:mongol@1.6.2
natestrauser:connection-banner@0.4.3
nemo64:bootstrap@3.3.5_2
nemo64:bootstrap-data@3.3.5
nooitaf:colors@0.0.3
notifications@0.0.6
npm-bcrypt@0.8.5
npm-container@1.2.0
npm-mongo@1.4.43
oauth@1.1.10
oauth2@1.1.9
observe-sequence@1.0.11
okgrow:analytics@1.0.6
ordered-dict@1.0.7
particle4dev:cordova-fb@1.1.3
peppelg:bootstrap-3-modal@1.0.4
pfafman:font-awesome-4@4.6.1
promise@0.6.7
raix:eventemitter@0.1.3
raix:eventstate@0.0.4
raix:handlebar-helpers@0.2.5
raix:push@3.0.2
random@1.0.9
rate-limit@1.0.4
reactive-dict@1.1.7
reactive-var@1.0.9
reload@1.1.8
reload-safetybelt@1.0.9
retry@1.0.7
reywood:publish-composite@1.4.2
routepolicy@1.0.10
sacha:juice@0.1.4
sacha:spin@2.3.1
service-configuration@1.0.9
session@1.1.5
sha@1.0.7
softwarerero:accounts-t9n@1.3.4
spacebars@1.0.11
spacebars-compiler@1.0.11
spiderable@1.0.13
srp@1.0.8
standard-app-packages@1.0.9
standard-minifier-css@1.0.6
standard-minifier-js@1.0.6
templating@1.1.9
templating-tools@1.0.4
tmeasday:publish-counts@0.7.3
tracker@1.0.13
ui@1.0.11
underscore@1.0.8
url@1.0.9
useraccounts:bootstrap@1.14.2
useraccounts:core@1.14.2
useraccounts:iron-routing@1.14.2
webapp@1.2.8
webapp-hashing@1.0.9
wylio:winston-papertrail@0.1.2
yogiben:pretty-email@0.0.7
zenorocha:clipboard@1.5.10
zimme:active-route@2.3.2
zimme:collection-behaviours@1.1.3
zimme:collection-timestampable@1.0.9

With so little overlap, the one that stands out is useraccounts. Also because it messes with routing and is loaded early on.

Would be interesting to hear if others who are experiencing this issue are using it?

1 Like

Yes I’m also using:

accounts-base
accounts-facebook
accounts-google
accounts-twitter

@elie, just to make things a little confusing, Cloudlfare appears to be using Nginx internally :smile:

But only Meteor standard packages, not useraccounts?

One important thing to note is that for me it doesnt have when deploying to
the main domain name. Only to the subdomain

Sorry, I missed that. No useraccounts for me.

One thing I just discovered is that if I add Cloudfront, I can get into an endless reload loop. And this loop is so bad that it will never stop. Even when I click stop in the browser.

Before I was using Cloudfront, the infinite looping would at least stop when I hit the refresh button in the browser.

FWIW, I upgraded my misbehaving site to 1.3.3-beta.2, and have been working all day doing hot code pushes without looping.

Now… due to the intermittent behavior of our problem this might mean nothing more than that there is a different code path that doesn’t trigger the race condition, or something similar.

But I thought I would tell you guys anyway.

2 Likes