Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Varnish: Misc

503 errors that are not backend timeouts? ( Wordpress )

 

 

Varnish misc RSS feed   Index | Next | Previous | View Threaded


kervin at adevsoft

Jul 27, 2012, 12:08 PM

Post #1 of 3 (1408 views)
Permalink
503 errors that are not backend timeouts? ( Wordpress )

I have a Wordpress install that gets occasional 503 errors on HTTP POST urls. And I need to find out what's causing these. Any help in tracking those down would be appreciated.

Looking at my logs I can see that the 503 errors are not timeouts. I've got the backend timeouts set to 5 minutes and Varnish log shows the 503 errors being sent between 5 to 40 seconds into the script run.

Can anyone tell me why Varnish would return a 503 error to the client besides after a backend timeout? ( HTTP GETs are not affected )

Section of the logs ( 503 occurs 39.8, 5.5 and 25 seconds into post script )...
16 SessionOpen c 91.x.x.x 50831 :80
16 RxURL c /wp-comments-post.php
16 TxStatus c 503
16 ReqEnd c 1117073234 1343394313.874103785 1343394353.676049232 0.000548363 39.801901102 0.000044346
26 RxURL c /wp-admin/admin-ajax.php
26 TxStatus c 503
26 ReqEnd c 1117393632 1343407124.979131699 1343407130.515117168 2.843032837 5.535950422 0.000035048
17 RxURL c /wp-admin/admin-ajax.php
17 TxStatus c 503
17 ReqEnd c 1117509532 1343412208.358498812 1343412233.383063078 2.842891693 25.024516821 0.000047445

Varnish config...

backend default {
.host = "10.x.x.x";
.port = "80";
.connect_timeout = 1m;
.first_byte_timeout = 5m;
.between_bytes_timeout = 5m;
}

sub vcl_recv
{
# Don't cache POST or PUT
if (req.request == "POST" || req.request == "PUT")
{
return(pass);
}

set req.grace = 2m;

if (req.http.Accept-Encoding)
{
#revisit this list
if (req.url ~ "\.(gif|jpg|jpeg|swf|flv|mp3|mp4|pdf|ico|png|gz|tgz|bz2)(\?.*|)$")
{
remove req.http.Accept-Encoding;
} elsif (req.http.Accept-Encoding ~ "gzip") {
set req.http.Accept-Encoding = "gzip";
} elsif (req.http.Accept-Encoding ~ "deflate") {
set req.http.Accept-Encoding = "deflate";
} else {
remove req.http.Accept-Encoding;
}
}

# Remove cookies on static content
if (req.url ~ "\.(gif|jpg|jpeg|swf|css|js|flv|mp3|mp4|pdf|ico|png)(\?.*|)$")
{
unset req.http.cookie;
set req.url = regsub(req.url, "\?.*$", "");
}

if (req.http.cookie)
{
return(pass);
}
}

sub vcl_fetch
{
# Keep stale objects in memory for a minute or two
set beresp.grace = 2m;

if (beresp.ttl <= 0s ||
beresp.http.Set-Cookie ||
beresp.http.Vary == "*")
{
/*
* Mark as "Hit-For-Pass" for the next 2 minutes
*/
set beresp.ttl = 120 s;
return (hit_for_pass);
}

return (deliver);
}

sub vcl_error
{
# retry on some errors
if (obj.status == 503)
{
if ( req.restarts < 3 )
{
return (restart);
}
}
}


_______________________________________________
varnish-misc mailing list
varnish-misc [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


daniel.carrillo at gmail

Jul 28, 2012, 2:56 AM

Post #2 of 3 (1359 views)
Permalink
Re: 503 errors that are not backend timeouts? ( Wordpress ) [In reply to]

2012/7/27 Kervin L. Pierre <kervin [at] adevsoft>:
> I have a Wordpress install that gets occasional 503 errors on HTTP POST urls. And I need to find out what's causing these. Any help in tracking those down would be appreciated.
>
> Looking at my logs I can see that the 503 errors are not timeouts. I've got the backend timeouts set to 5 minutes and Varnish log shows the 503 errors being sent between 5 to 40 seconds into the script run.
>
> Can anyone tell me why Varnish would return a 503 error to the client besides after a backend timeout? ( HTTP GETs are not affected )

It sounds like this ticket:

https://www.varnish-cache.org/trac/ticket/849

The workaround is "piping" POST request, and wait an implementation
which buffers the request-body.

Hope this helps.

_______________________________________________
varnish-misc mailing list
varnish-misc [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


kervin at adevsoft

Jul 28, 2012, 12:05 PM

Post #3 of 3 (1362 views)
Permalink
RE: 503 errors that are not backend timeouts? ( Wordpress ) [In reply to]

Hi Daniel,

Thanks for the link. I actually ran into this ticket earlier put didn't read it in detail. And you're right, this is the issue I'm facing, thanks!

It's disappointing to see the bug was closed as 'invalid' though. This seems to be a potentially very common bug. I'm not doing anything 'exotic' in this install. And the workaround seems to be "don't let varnish touch HTTP POSTs".

But at any rate, I will try piping all POSTs as the you suggested.

Best regards,
Kervin

Adevsoft Inc
Business Software Development
http://adevsoft.com/


> -----Original Message-----
> From: Daniel Carrillo [mailto:daniel.carrillo [at] gmail]
> Sent: Saturday, July 28, 2012 5:57 AM
> To: Kervin L. Pierre
> Cc: varnish-misc [at] varnish-cache
> Subject: Re: 503 errors that are not backend timeouts? ( Wordpress )
>
> 2012/7/27 Kervin L. Pierre <kervin [at] adevsoft>:
> > I have a Wordpress install that gets occasional 503 errors on HTTP
> POST urls. And I need to find out what's causing these. Any help in
> tracking those down would be appreciated.
> >
> > Looking at my logs I can see that the 503 errors are not timeouts.
> I've got the backend timeouts set to 5 minutes and Varnish log shows
> the 503 errors being sent between 5 to 40 seconds into the script run.
> >
> > Can anyone tell me why Varnish would return a 503 error to the client
> > besides after a backend timeout? ( HTTP GETs are not affected )
>
> It sounds like this ticket:
>
> https://www.varnish-cache.org/trac/ticket/849
>
> The workaround is "piping" POST request, and wait an implementation
> which buffers the request-body.
>
> Hope this helps.



_______________________________________________
varnish-misc mailing list
varnish-misc [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Varnish misc RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.