503 errors that are not backend timeouts? ( Wordpress )

Kervin L. Pierre kervin at adevsoft.com
Fri Jul 27 21:08:56 CEST 2012


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);
        }
    }
}




More information about the varnish-misc mailing list