Error 503 Service Unavailable / Service Unavailable / Guru Meditation

X.H.R.F.C. xhrfc at yahoo.com
Fri Jun 15 11:34:11 CEST 2012


Hello,

I have a wired problem with varnish, i get "Error 503 Service Unavailable / Service Unavailable / Guru Meditation". This is not happening all the time! If i restart varnishd all things are fine for random 5-10 mins.
I checked varnishlog and i get : "9 FetchError   c no backend connection". Strange thing because my 3 nginx servers are up and running just fine, checked error log on all of them and there is no problem :|
I searched on google and from many results i'v read prev message from Abraham Cruz (https://www.varnish-cache.org/lists/pipermail/varnish-misc/2012-June/022127.html), i tryed to setup like he has in there but i receive same error.

So here are some pastes from varnishlog and my vcls.
Please let me know if i have some config erorr or something, i can't figure out what is wrong in here and why i get this.

I'm using Varnish 3.0.0~beta1-1~squeeze2 on Debian 6 machine.

# ---- start varnishlog
9 SessionOpen  c xxx.xxx.xxx.xxx 49940 website.com:80
    9 ReqStart     c xxx.xxx.xxx.xxx 49940 905690731
    9 RxRequest    c GET
    9 RxURL        c /auth/login
    9 RxProtocol   c HTTP/1.1
    9 RxHeader     c Host: website.com
    9 RxHeader     c User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0
    9 RxHeader     c Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    9 RxHeader     c Accept-Language: en-us,en;q=0.5
    9 RxHeader     c Accept-Encoding: gzip, deflate
    9 RxHeader     c Connection: keep-alive
    9 RxHeader     c Cookie: __utma=163271977.1649200775.1339623409.1339678556.1339688677.4; AutoLogin=aa0cb1ba10b4f859d5ab6eab2fe8cb6f4be48867%7E7b40ad672393bf7738c6d065101f44283396ef11; __utmz=163271977.1339661812.2.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __un
    9 VCL_call     c recv lookup
    9 VCL_call     c hash
    9 Hash         c /auth/login
    9 Hash         c website.com
    9 VCL_return   c hash
    9 VCL_call     c miss fetch
    9 FetchError   c no backend connection
    9 VCL_call     c error deliver
    9 VCL_call     c deliver deliver
    9 TxProtocol   c HTTP/1.1
    9 TxStatus     c 503
    9 TxResponse   c Service Unavailable
    9 TxHeader     c Server: Varnish
    9 TxHeader     c Content-Type: text/html; charset=utf-8
    9 TxHeader     c Retry-After: 5
    9 TxHeader     c Content-Length: 418
    9 TxHeader     c Accept-Ranges: bytes
    9 TxHeader     c Date: Fri, 15 Jun 2012 09:20:01 GMT
    9 TxHeader     c X-Varnish: 905690731
    9 TxHeader     c Age: 0
    9 TxHeader     c Via: 1.1 varnish
    9 TxHeader     c Connection: close
    9 Length       c 418
    9 ReqEnd       c 905690731 1339752001.003274202 1339752001.003641129 0.000065327 0.000314951 0.000051975
    9 SessionClose c error
    9 StatSess     c xxx.xxx.xxx.xxx 49940 0 1 1 0 0 0 256 418
    0 CLI          - Rd ping
    0 CLI          - Wr 200 19 PONG 1339752003 1.0
    0 CLI          - Rd ping
    0 CLI          - Wr 200 19 PONG 1339752006 1.0
    0 CLI          - Rd ping
    0 CLI          - Wr 200 19 PONG 1339752009 1.0
    0 CLI          - Rd ping
# ---- end varnish log

# ---- start /etc/defaults/varnish
START=yes
NFILES=131072
MEMLOCK=82000
DAEMON_OPTS="-a website.com:80 \
             -T drr0003:6082 \
             -f /etc/varnish/website.vcl \
             -S /etc/varnish/secret \
             -s malloc,2G"
# ---- end /etc/defaults/varnish

# ---- start /etc/varnish/website.vcl
# server 1
backend drr0001 {
    .host = "drr0001";
    .port = "80";
    .probe = {
                .url = "/";
                .interval = 10m;
                .timeout = 500s;
                .window = 5;
                .threshold = 3;
  }
}

# server 2
backend drr0002 {
    .host = "drr0002";
    .port = "80";
    .probe = {
                .url = "/";
                .interval = 10m;
                .timeout = 500s;
                .window = 5;
                .threshold = 3;
  }

}

# server 3
backend drr0003 {
    .host = "drr0003";
    .port = "80";
    .probe = {
                .url = "/";
                .interval = 10m;
                .timeout = 500s;
                .window = 5;
                .threshold = 3;
  }

}

# Round-Robin load balance
director website round-robin {
        {
                .backend = drr0001;
        }
        {
                .backend = drr0002;
        }
        {
                .backend = drr0003;
        }
}

# ACL to allow cache Purge
acl purge {
    "drr0001";
    "drr0002";
    "drr0003";
}

# Receive
sub vcl_recv {
    # check acl purge at the top and purges
      if (req.request == "PURGE") 
        {
                if (!client.ip ~ purge) {
                  error 404 "Not Found";
            }
            return (lookup);
      }
  
    if (! req.http.Host)
    {
        error 404 "Your query need a host header !";
    }
    if (req.http.Host ~ "website.com")
    {
        set req.backend = website;
        include "/etc/varnish/website-esi-recv.vcl";
    }
    else
    {
        error 404 "No Varnish configuration for your host header.";
    }
}

## FETCH
sub vcl_fetch {
    if (req.http.Host ~ "test.website.com")
    {
        include "/etc/varnish/website-esi-fetch.vcl";
    }
    else
    {
        return (deliver);
    }
}

# HIT
sub vcl_hit {
    if (req.request == "PURGE") {
        purge;
        error 200 "Purged.";
    }
}

# MISS
sub vcl_miss {
    if (req.request == "PURGE") {
        purge;
        error 200 "Purged.";
    }
}


## DELIVER
sub vcl_deliver {
    # Secure the header
    # remove resp.http.Via;
    # remove resp.http.X-Varnish;
    # remove resp.http.Server;
    # remove resp.http.X-Powered-By;
}
# ---- end /etc/varnish/website.vcl

# ---- start /etc/varnish/website-esi-recv.vcl
# Compatiblity with Apache log
remove req.http.X-Forwarded-For;
set    req.http.X-Forwarded-For = client.ip;

# Post requests will not be cached
if (req.request == "POST") 
{
    return (pass);
}

# Normalize encoding/compression
if (req.http.Accept-Encoding) 
{
    if (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; 
    }
}

# Serve the page
unset req.http.vary;

if (req.url ~ "\.(jpeg|jpg|png|gif|ico|js|css|txt|gz|zip|lzma|bz2|tgz|tbz|html|htm)$") {
    # Remove the cookie and make the request static
    unset req.http.cookie;
    return (lookup);
}
# Try to lookup in the cache
return (lookup);

# Cookie ? Not cacheable by default
if (req.http.Authorization || req.http.Cookie) {
    return (pass);
}
# ---- end /etc/varnish/website-esi-recv.vcl

# ---- start /etc/varnish/website-esi-fetch.vcl
# Enable ESI
set beresp.do_esi = true;
set beresp.ttl = 0s;

# Defining TTL for specific URLs
if (req.url ~ "\.(ico|js|css)$") {
    set beresp.ttl = 24h;
}

if (req.url ~ "\/other1\/([0-9]+$)\/") {
    set beresp.ttl = 10s;
}
if (req.url ~ "\/other2\/([0-9]+$)\/") {
    set beresp.ttl = 24h;
}

return (deliver);
# ---- end /etc/varnish/website-esi-fetch.vcl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20120615/a95501c6/attachment-0001.html>


More information about the varnish-misc mailing list