[Varnish] #1731: 4.0.3 Panic

Varnish varnish-bugs at varnish-cache.org
Wed May 6 05:35:11 CEST 2015


#1731: 4.0.3 Panic
-----------------------+----------------------------------
 Reporter:  billnbell  |       Owner:
     Type:  defect     |      Status:  new
 Priority:  highest    |   Milestone:  Varnish 4.0 release
Component:  varnishd   |     Version:  4.0.3
 Severity:  normal     |  Resolution:
 Keywords:             |
-----------------------+----------------------------------

Comment (by billnbell):

 What does s,f,r,e mean? Does it mean that I went over by 52256 bytes? It
 seemed like we were only doing 5 retries.  Why would it need more than the
 default fix for these parameters?

 Should I try both workspace_backend and workspace_client? What are the
 issue with increasing this?  Is 252144 a good size?

 Here are the 2 functions you requested.

 If I comment out the following section, the problem goes away. The max
 retries is the default, so it should stop right? Or is it infinite
 looping?

   if ( beresp.status >= 500 && beresp.status < 600) {
         return(retry);
   }

 Here ya go:

 sub vcl_backend_fetch {
     if(bereq.http.X-Backend-Type == "m") {
         set bereq.backend = m.backend();
     } else if(bereq.http.X-Backend-Type == "hg_tips") {
         set bereq.backend = hg_tips.backend();
     } else if(bereq.http.X-Backend-Type == "hg") {
         set bereq.backend = hg.backend();
     } else if(bereq.http.X-Backend-Type == "articles") {
         set bereq.backend = articles.backend();
     }


     if(bereq.url ~ "(?i)^/(?!provider-search)[^/]+-directory(/[^/]+)?/?$")
 {
         unset bereq.http.set-cookie;
         unset bereq.http.Cookie;
     }
     return (fetch);
 }

 sub vcl_backend_response {
   if ( beresp.status >= 500 && beresp.status < 600) {
         return(retry);
   }
   if ( beresp.backend.name ~ "(web|mobile|hg3)") {
         if(bereq.url ~ "(?i)^/error$" && beresp.backend.name ~ "mobile" )
 {
             set beresp.status = 500;
         }
         if(bereq.http.Accept-Encoding ~ "gzip" && beresp.http.Content-
 Encoding ~ "^\s*$") {
                 if ((beresp.http.content-type ~ "\/xml") ||
                         (beresp.http.content-type ~ "\/json") ||
                         (beresp.http.content-type ~ "^text\/") ||
                         (beresp.http.content-type ~
 "^application\/x-javascript") ||
                         (beresp.http.content-type ~ "^image\/svg\+xml") ||
                         (beresp.http.content-type ~ "^application\/x-font-
 ttf") ||
                         (beresp.http.content-type ~ "^application\/x-font-
 woff") ||
                         (beresp.http.content-type ~ "^application\/font-
 woff") ||
                         (beresp.http.content-type ~ "^application\/font-
 ttf") ||
                         (beresp.http.content-type ~ "^application\/font-
 otf") ||
                         (beresp.http.content-type ~ "^application\/vnd
 \.ms-fontobject") ||
                         (beresp.http.content-type ~ "^application\/x-font-
 opentype") ||
                         (beresp.http.content-type ~
 "^application\/javascript") ||
                         (beresp.http.content-type ~ "\/html")) {
                                 set beresp.do_gzip = true;
                 }
         }
         if(bereq.url ~ ".(png|ico|js)$") {
             unset beresp.http.Set-Cookie;
             unset beresp.http.expires;
             set beresp.http.X-Cache-Control = "1";
             unset beresp.http.cache-control;
             unset beresp.http.pragma;
             unset beresp.http.last-modified;
             set beresp.ttl = 30m;
         }

         if (beresp.http.Vary !~ "User-Agent") {
            if (beresp.http.Content-Type ~ "text/html") {
                if (beresp.http.Vary !~ "^\s*$") {
                    set beresp.http.Vary = beresp.http.Vary + ", User-
 Agent";
                } else {
                    set beresp.http.Vary = "User-Agent";
                }
            }
         } else {
            if (beresp.http.Content-Type !~ "text/html") {
               set beresp.http.Vary = regsub(beresp.http.Vary, ",? *User-
 Agent *", "");
               set beresp.http.Vary = regsub(beresp.http.Vary, "^, *", "");
               if (beresp.http.Vary == "") {
                 unset beresp.http.Vary;
               }
            }
         }
         if (beresp.http.Vary !~ "Accept-Encoding" && beresp.http.Content-
 Encoding ~ "gzip|deflate") {
             if (beresp.http.Vary !~ "^\s*$") {
                 set beresp.http.Vary = beresp.http.Vary + ", Accept-
 Encoding";
             } else {
                 set beresp.http.Vary = "Accept-Encoding";
             }
         }
         set beresp.http.X-Vary = beresp.http.Vary;
         unset beresp.http.Vary;
         set beresp.http.X-Backend-Name = beresp.backend.name;
         if(bereq.url ~ "(?i)^/(?!provider-
 search)[^/]+-directory(/[^/]+)?/?$") {
             unset beresp.http.Set-Cookie;
             unset beresp.http.expires;
             unset beresp.http.cache-control;
             unset beresp.http.pragma;
             unset beresp.http.last-modified;
             set beresp.ttl = 15m;
 #            return(deliver);
         }
   } else {
       unset beresp.http.Set-Cookie;
       unset beresp.http.expires;
       set beresp.http.X-Cache-Control = "1";
       unset beresp.http.cache-control;
       unset beresp.http.pragma;
       unset beresp.http.last-modified;
       set beresp.http.X-Vary = beresp.http.Vary;
       unset beresp.http.Vary;
       if ((beresp.http.content-type ~ "\/xml") ||
           (beresp.http.content-type ~ "\/json") ||
           (beresp.http.content-type ~ "^text\/") ||
           (beresp.http.content-type ~ "^application\/x-javascript") ||
           (beresp.http.content-type ~ "^image\/svg\+xml") ||
           (beresp.http.content-type ~ "^application\/x-font-ttf") ||
           (beresp.http.content-type ~ "^application\/x-font-woff") ||
           (beresp.http.content-type ~ "^application\/font-woff") ||
           (beresp.http.content-type ~ "^application\/font-ttf") ||
           (beresp.http.content-type ~ "^application\/font-otf") ||
           (beresp.http.content-type ~ "^application\/vnd\.ms-fontobject")
 ||
           (beresp.http.content-type ~ "^application\/x-font-opentype") ||
           (beresp.http.content-type ~ "^application\/javascript") ||
           (beresp.http.content-type ~ "\/html")) {
             set beresp.do_gzip = true;
       }

       set beresp.grace = 1h;

       if (bereq.url == "/home/PageNotFound") {
           set beresp.ttl = 0s;
       } else {
           set beresp.ttl = 15m;
       }

       set beresp.http.X-Backend = beresp.backend.ip;
   }
   # set one hour cache for TIPS
   if(beresp.backend.name ~ "hg_tips") {
       set beresp.ttl = 60m;
   }
   if (beresp.status == 404) {
         set beresp.http.X-Cache-Control = "2";
         set beresp.ttl = 30s;
   }
 }

-- 
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1731#comment:5>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator



More information about the varnish-bugs mailing list