We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

EE & Varnish produces Error 503 intermittently

How Do I?

Linda A's avatar
Linda A
647 posts
9 years ago
Linda A's avatar Linda A

We’re running into an issue with having EE & Varnish together. Everytime a page is loaded for the first time in a while (I am guessing there’s a connection between cache expiry), we get this error:

Error 503 Service Unavailable

Service Unavailable Guru Meditation:

XID: 153391359

Varnish cache server

Reloading the page again loads the page normally.

Is this an issue with the EE caching (it happens 100% of the time after a template has been updated and the EE caches cleared) or purely with Varnish? If so, is there anything I can pass on to our sysadmin (who was the one whose setup Varnish)?

       
Pedro Guimaraes's avatar
Pedro Guimaraes
170 posts
9 years ago
Pedro Guimaraes's avatar Pedro Guimaraes

Could you post your varnish config file here for us to take a look at?

       
Linda A's avatar
Linda A
647 posts
9 years ago
Linda A's avatar Linda A

I am not strictly sure if this is it (we don’t handle this ourselves), but might this be the Varnish config: https://jpst.it/GcCg ?

       
Pedro Guimaraes's avatar
Pedro Guimaraes
170 posts
9 years ago
Pedro Guimaraes's avatar Pedro Guimaraes

I suggest trying a simpler config file and then slowly adding one line at a time to match your current config file to see where the issue is. Here’s a great article from EllisLab that is very helpful:

Making Sites Fly with Varnish

       
Linda A's avatar
Linda A
647 posts
9 years ago
Linda A's avatar Linda A

Unfortunately, EE isn’t the only thing running on the server, so I am not sure we can take that approach without causing other issues. But I will pass it on to our sysadmin to see what she thinks. Thank you. 😊

       
Pedro Guimaraes's avatar
Pedro Guimaraes
170 posts
9 years ago
Pedro Guimaraes's avatar Pedro Guimaraes

Linda,

You should be able to as you can apply varnish settings based on IP or hostname.

Best, Pedro

       
Kevin Cupp's avatar
Kevin Cupp
791 posts
9 years ago
Kevin Cupp's avatar Kevin Cupp

Thanks for posting your VCL. Is the website having the problems listed in this conditional?

if (req.http.Host == "westeros.org" || req.http.Host == "www.westeros.org" || req.http.Host == "testsite.westeros.org" || req.http.Host ~ "hippokrene.com" || req.http.Host ~ "hippoiathanatoi.com" ) {
    set req.backend = apache;
}
       
Linda A's avatar
Linda A
647 posts
9 years ago
Linda A's avatar Linda A

Yes, it is westeros.org/www.westeros.org and hippoiathanatoi.com that’s having the issue (hippokrene.com doesn’t use EE).

       
Kevin Cupp's avatar
Kevin Cupp
791 posts
9 years ago
Kevin Cupp's avatar Kevin Cupp

Hmm, it’s hard to say then. I wouldn’t think ExpressionEngine would be causing this, it seems like Varnish may think the backend is unhealthy and is just timing out. You already have first_byte_timeout on your apache backend which is good, that was going to be my first suggestion, which is why I asked if your sites were in that conditional.

Outside of that, I’d maybe try increasing the connect_timeout property on the backend from its default of 3.5 seconds. I wouldn’t normally think you’d need to increase that, but worth a shot. Also maybe try looking at the Varnish logs to see if you can see how its deciding to show a 503.

       
Linda A's avatar
Linda A
647 posts
9 years ago
Linda A's avatar Linda A

Okay, our friendly server admin set up a version entirely out of Varnish and we still get the error:

http://westeros-test.noderunner.net:8081/

If someone has visited it recently, it’ll pull from EE’s cache… but if not, you’ll get a content encoding error. Unfortunately, I’m not sure how to diagnose the problem further, but this does fit what the server admin speculated:

“t looks to me in Varnish’s logs like what happens is ExpressionEngine sends back a corrupted page; Varnish can’t parse it as a valid HTTP body and dies.

If my theory is right, then Chrome or Safari will also refuse to render the page appropriately when you trip the issue; i.e., the Varnish Guru issue isn’t Varnish, it’s just Varnish tossing up a webpage when ExpressionEngine throws back random garbage data instead of text/html content.”

       
Kevin Cupp's avatar
Kevin Cupp
791 posts
9 years ago
Kevin Cupp's avatar Kevin Cupp

Interesting. Do you have gzip compression enabled for this site? I’d try disabling that, if so, or any other output compression you may have going on.

       
Linda A's avatar
Linda A
647 posts
9 years ago
Linda A's avatar Linda A

Thank you, looking at the gzip led us down the right path. It turned out to be an issue with Magpie pulling in an RSS stream that had changed and was throwing errors.

       
Kevin Cupp's avatar
Kevin Cupp
791 posts
9 years ago
Kevin Cupp's avatar Kevin Cupp

Ah interesting! Thanks for letting us know, glad you got it sorted!

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.