4.0-tp1: obj.hits not incremented

Delacroix, Gauthier Gauthier.Delacroix at coreye.fr
Mon Jan 20 09:31:53 CET 2014


Hi, 

I'm trying Varnish 4.0-tp1 on Linux Fedora 20 and I've found that obj.hits doesn't seem to be incremented anymore.

Here is a simple example with this VCL :

sub vcl_backend_response {
  unset beresp.http.Set-Cookie;
  set beresp.ttl = 3600s;
}

sub vcl_deliver {
  set resp.http.Hits = obj.hits;
}

Here's the varnishlog showing that I have a HIT, but obj.hits is zero :

*   << Request  >> 32770
-   Begin          req 32769
-   ReqMethod      GET
-   ReqURL         http://XXXX/icons/poweredby.png
-   ReqProtocol    HTTP/1.1
-   ReqHeader      Host: XXXX
-   ReqHeader      User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0
-   ReqHeader      Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
-   ReqHeader      Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
-   ReqHeader      Accept-Encoding: gzip, deflate
-   ReqHeader      Connection: keep-alive
-   ReqHeader      Pragma: no-cache
-   ReqHeader      Cache-Control: no-cache
-   ReqStart       10.0.2.2 51974
-   VCL_call       RECV
-   VCL_return     hash
-   VCL_call       HASH
-   VCL_return     lookup
-   Hit            2147483651
-   VCL_call       HIT
-   VCL_return     deliver
-   VCL_call       DELIVER
-   VCL_return     deliver
-   Debug          "RES_MODE 2%00"
-   RespProtocol   HTTP/1.1
-   RespStatus     200
-   RespResponse   OK
-   RespHeader     Server: Apache/2.4.6 (Fedora) mod_perl/2.0.9-dev Perl/v5.18.2
-   RespHeader     Last-Modified: Thu, 04 Apr 2013 19:44:33 GMT
-   RespHeader     ETag: "bda-4d98e331d8a40"
-   RespHeader     Content-Type: image/png
-   RespHeader     Date: Fri, 17 Jan 2014 10:21:56 GMT
-   RespHeader     X-Varnish: 32770 3
-   RespHeader     Age: 3
-   RespHeader     Via: 1.1 varnish
-   RespHeader     Hits: 0
-   RespHeader     Content-Length: 3034
-   RespHeader     Connection: keep-alive
-   RespHeader     Accept-Ranges: bytes
-   Debug          "XXX REF 2%00"
-   Length         0
-   ReqEnd         1389954116.455149174 1389954116.455080271 -0.000174284 0.000105381 -0.000174284
-   End

My real VCL is using a condition (if (obj.hits > 0)...) that thus doesn't work.

I've also tried with the same problem :
- obj.hits in vcl_hit
- todays master head

I didn't find this in known issues.
I didn't have this problem with Varnish 3.0.X

Is this a bug ?

Thanks !

Gauthier



More information about the varnish-dev mailing list