[Varnish] #862: locking varnish

Varnish varnish-bugs at varnish-cache.org
Sat Feb 19 19:25:17 CET 2011


#862: locking varnish
---------------------------------+------------------------------------------
 Reporter:  santosmr             |        Type:  defect  
   Status:  new                  |    Priority:  high    
Milestone:  Varnish 2.1 release  |   Component:  varnishd
  Version:  trunk                |    Severity:  critical
 Keywords:                       |  
---------------------------------+------------------------------------------
 Hello

 My varnish hangs from time to time something for 24 hours.
 In the log I found the following message: /var/log/messages

 Feb 17 10:52:06 proxyb2 varnishd[12396]: Child (12401) said
 Feb 17 10:52:06 proxyb2 varnishd[12396]: Child (12401) said Child starts
 Feb 17 10:52:06 proxyb2 varnishd[12396]: Child (12401) said managed to
 mmap 2147483648 bytes of 2147483648
 Feb 17 10:52:06 proxyb2 varnishd[12396]: Child (12401) said Child dies
 Feb 17 10:52:06 proxyb2 varnishd[12396]: Child (12401) died
 Feb 17 10:53:07 proxyb2 varnishd[12396]: Manager got SIGINT
 Feb 17 10:53:09 proxyb2 varnishd[12502]: child (12507) Started
 Feb 17 10:53:09 proxyb2 varnishd[12502]: Pushing vcls failed:
 dlopen(./vcl.1P9zoqAU.so): ./vcl.1P9zoqAU.so: cannot open shared object
 file: Permission denied

 varnishadm and went into my output is:

 param.show
 200 2367
 acceptor_sleep_decay       0.900000 []
 acceptor_sleep_incr        0.001000 [s]
 acceptor_sleep_max         0.050000 [s]
 auto_restart               on [bool]
 ban_lurker_sleep           0.000000 [s]
 between_bytes_timeout      60.000000 [s]
 cache_vbe_conns            off [bool]
 cc_command                 "exec cc -fpic -shared -Wl,-x -o %o %s"
 cli_buffer                 8192 [bytes]
 cli_timeout                10 [seconds]
 clock_skew                 10 [s]
 connect_timeout            0.400000 [s]
 critbit_cooloff            180.000000 [s]
 default_grace              10 [seconds]
 default_ttl                120 [seconds]
 diag_bitmap                0x0 [bitmap]
 err_ttl                    0 [seconds]
 esi_syntax                 0 [bitmap]
 fetch_chunksize            128 [kilobytes]
 first_byte_timeout         60.000000 [s]
 group                      varnish (102)
 http_headers               64 [header lines]
 http_range_support         off [bool]
 listen_address             :80
 listen_depth               1024 [connections]
 log_hashstring             off [bool]
 log_local_address          off [bool]
 lru_interval               2 [seconds]
 max_esi_includes           5 [includes]
 max_restarts               4 [restarts]
 overflow_max               100 [%]
 ping_interval              3 [seconds]
 pipe_timeout               60 [seconds]
 prefer_ipv6                off [bool]
 purge_dups                 on [bool]
 rush_exponent              3 [requests per request]
 saintmode_threshold        10 [objects]
 send_timeout               600 [seconds]
 sess_timeout               10 [seconds]
 sess_workspace             65536 [bytes]
 session_linger             50 [ms]
 session_max                100000 [sessions]
 shm_reclen                 255 [bytes]
 shm_workspace              8192 [bytes]
 syslog_cli_traffic         on [bool]
 thread_pool_add_delay      20 [milliseconds]
 thread_pool_add_threshold  2 [requests]
 thread_pool_fail_delay     200 [milliseconds]
 thread_pool_max            2000 [threads]
 thread_pool_min            10 [threads]
 thread_pool_purge_delay    1000 [milliseconds]
 thread_pool_stack          unlimited [bytes]
 thread_pool_timeout        120 [seconds]
 thread_pools               2 [pools]
 thread_stats_rate          10 [requests]
 user                       varnish (101)
 vcl_trace                  off [bool]
 waiter                     default (epoll, poll)


 and

 stats
 200 1951
       143048  Client connections accepted
       682714  Client requests received
       480993  Cache hits
       196973  Cache misses
        15674  Backend conn. success
       186049  Backend conn. reuses
        14918  Backend conn. was closed
       200975  Backend conn. recycles
            1  Fetch head
       187473  Fetch with Length
        14099  Fetch chunked
           89  Fetch wanted close
           52  Fetch zero len
          202  N struct sess_mem
          114  N struct sess
         9527  N struct object
         9548  N struct objectcore
         1980  N struct objecthead
        19768  N struct smf
          555  N small free smf
            2  N large free smf
            7  N struct vbe_conn
           25  N worker threads
          565  N worker threads created
         5766  N overflowed work requests
            6  N backends
       187446  N expired objects
       265340  N LRU moved objects
       632047  Objects sent with write
       143043  Total Sessions
       682714  Total Requests
         4748  Total pass
       201714  Total fetch
    192649441  Total header bytes
   6922785643  Total body bytes
        11120  Session Closed
          677  Session Pipeline
          844  Session Read Ahead
       672822  Session Linger
       658718  Session herd
     33830604  SHM records
      2233862  SHM writes
           17  SHM flushes due to overflow
          372  SHM MTX contention
           15  SHM cycles through buffer
       399606  allocator requests
        19211  outstanding allocations
    338653184  bytes allocated
   1808830464  bytes free
            7  SMS allocator requests
         3493  SMS bytes allocated
         3493  SMS bytes freed
       201718  Backend requests made
            1  N vcl total
            1  N vcl available
            1  N total active purges
            1  N new purges added
       677949  HCB Lookups without lock
        28241  HCB Lookups with lock
        28241  HCB Inserts
        36255  Client uptime


 My profile *.vcl

 # Define as maquinas de backend
 backend blog1 {
         .host = "10.17.0.100";
         .port = "80";
         .connect_timeout = 50s;
         .first_byte_timeout = 120s;
         .between_bytes_timeout = 50s;
 }

 backend blog2 {
         .host = "10.17.0.101";
         .port = "80";
         .connect_timeout = 50s;
         .first_byte_timeout = 120s;
         .between_bytes_timeout = 50s;
 }

 backend blog3 {
         .host = "10.17.0.102";
         .port = "80";
         .connect_timeout = 50s;
         .first_byte_timeout = 120s;
         .between_bytes_timeout = 50s;
 }

 backend blog4 {
         .host = "10.17.0.99";
         .port = "80";
         .connect_timeout = 50s;
         .first_byte_timeout = 120s;
         .between_bytes_timeout = 50s;
 }

 backend blog5 {
         .host = "10.17.0.98";
         .port = "80";
         .connect_timeout = 50s;
         .first_byte_timeout = 120s;
         .between_bytes_timeout = 50s;
 }

 backend blog6 {
         .host = "10.17.0.97";
         .port = "80";
         .connect_timeout = 50s;
         .first_byte_timeout = 120s;
         .between_bytes_timeout = 50s;
 }

 director web_director round-robin {
         { .backend = blog1; }
         { .backend = blog2; }
         { .backend = blog3; }
         { .backend = blog4; }
         { .backend = blog5; }
         { .backend = blog6; }
 }

 # ACL para o purge list
 acl purge {
         "localhost";
 sub vcl_recv {
         # normalize Accept-Encoding to reduce vary
         if (req.http.Accept-Encoding) {
                 if (req.http.User-Agent ~ "MSIE 6") {
                         unset 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 {
                         unset req.http.Accept-Encoding;
                 }
         }

         # PURGE
         if (req.request == "PURGE") {
                 if (!client.ip ~ purge) {
                         error 403 "Forbbiden.";
                 }

                 # Purging ban-lurker friendly
                 purge("obj.http.X-Cache-Url ~ ^" req.url "$ && obj.http.X
 -Cache-Hostname == " req.http.host);

                 error 200 "Purged.";
                 return (lookup);
         }

         # Informa o tipo de backend, no caso balanceamento
         set req.backend = web_director;
         # Se for administracao, ou wp-cron, nao fazer cache
         if (req.url ~ "wp-(login|admin|cron)") {
                return (pass);
         }

         # Ativa PURGES depois de posts de comentarios
         #if (req.request == "POST" && req.url ~ "wp-comments-post.php") {
         #       if (req.http.host ~ "^(www.)?bispomacedo.com.br$") {
         #                       # limpa a home do usuário.
         #                purge("req.url ==
 "regsub(req.http.Referer,"http://(www.)?bispomacedo.com.br",""));
         #                # limpa a pagina do post.
         #                purge("req.url ==
 "regsub(req.http.Referer,"http://(www.)?bispomacedo.com.br/([^/.]*)/(.*)$","/\2/"));
         #        } elsif (req.http.host ~ "^(www.)?bispomacedo.blog.br$")
 {
         #                # limpa a home do usuário.
         #                purge("req.url ==
 "regsub(req.http.Referer,"http://(www.)?bispomacedo.blog.br",""));
         #                # limpa a pagina do post.
         #                purge("req.url ==
 "regsub(req.http.Referer,"http://(www.)?bispomacedo.blog.br/([^/.]*)/(.*)$","/\2/"));
         #        }
         #}

         # Nao faz cache de requisicoes que nao sejam estas GET ou HEAD
         if (req.request != "GET" && req.request != "HEAD") { return
 (pass); }

         # Se por acaso o usuario estiver logado ou usou site
 (comentarios), entao nao fazer cache
         if (req.http.Authorization || req.http.Cookie ~ "wordpress_") {
                 return (pass);
         }

         # Se o header informar para não fazer cache, obdecemos ...
         if (req.http.Cache-Control ~ "no-cache") {
                 return (pass);
         }

         # Excessoes de cache
         if (req.url ~ "/wp-content/plugins/wp-email/email-image-
 verify.php") {
                 return (pass);
         }

         # Se chegou ate aqui, e' vistante comum e nao se enquadra em cache
         return (lookup);
 }

 sub vcl_fetch {
         # Se for administracao, ou wp-cron, nao fazer cache
         if (req.url ~ "wp-(login|admin|cron)") {
                 return (pass);
         }

         # Configura cabecalhos especiais para o uso do ban lurker
         set beresp.http.X-Cache-Url = req.url;
         set beresp.http.X-Cache-Hostname = req.http.host;

         # Cache para os objetos
         set beresp.cacheable = true;

         # Tempo de vida dos objetos
         if (req.url ~
 "\.(jpg|jpeg|gif|png|tiff|tif|svg|swf|ico|mp3|mp4|m4a|ogg|mov|avi|wmv)$")
 { set beresp.ttl = 60m; } # Imagens e
 multimedia - 60 minutos
         elsif (req.url ~ "\.(css|js)$") { set beresp.ttl = 10m; } # CSS e
 JavaScript - 10 minutos
         else { set beresp.ttl = 1m; } # Como padrao - 1 minuto

         # Entrega
         return (deliver);

         # Retira os cookies da jogada
         unset beresp.http.Set-Cookie;

         # Se o backend falhar, servir do cache com tempo de vida ate 30
 minutos
         set req.grace = 30m;
 }

 sub vcl_deliver {
         # Retira os cabecalhos especiais de uso do ban lurker
         unset resp.http.X-Cache-Url;
         unset resp.http.X-Cache-Hostname;

         # Retira os cabecalhos de informacoes de forward do varnish
         unset resp.http.x-served-by-hostname;
         unset resp.http.x-served-by-identity;
         unset resp.http.x-varnish;
         unset resp.http.via;

         return (deliver);
 }

 sub vcl_pipe {
         unset bereq.http.x-varnish;
         set bereq.http.connection = "close";

         return (pipe);
 }

 sub vcl_pass {
         #unset bereq.http.x-varnish;
         return (pass);
 }

 sub vcl_hit {
         if (req.request == "PURGE") {
                 set obj.ttl = 0s;
                 error 200 "Purged.";
         }

         if (!obj.cacheable) {
                 return (pass);
         }
         return (deliver);
 }

 sub vcl_miss {
         unset bereq.http.x-varnish;

         if (req.request == "PURGE") {
                 error 404 "Not in cache.";
         }
         return (fetch);
 }

 sub vcl_error {
     #if (obj.status == 503) {
     #    restart;
     #}

      set obj.http.eontent-Type = "text/html; charsetnutf-8";
      synthetic {"
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  <html>
    <head>
      <title>"} obj.status " " obj.response {"</title>
    </head>
    <body>
      <h1>Error "} obj.status " " obj.response {"</h1>
      <p>"} obj.response {"</p>
      <h3>Guru Meditation</h3>
      <p>XID: "} req.xid {"</p>
      <hr>
      <address>
         <a href="http://bispomacedo.com.br/">Blog do Bispo Macedo</a>
      </address>
    </body>
  </html>
 "};
      return (deliver);
 }



 could help me with this little problem

 tks

 santosmr

-- 
Ticket URL: <http://varnish-cache.org/trac/ticket/862>
Varnish <http://varnish-cache.org/>
The Varnish HTTP Accelerator




More information about the varnish-bugs mailing list