[Varnish] #1823: vcl in discarded mode does not clear up

Varnish varnish-bugs at varnish-cache.org
Sun Dec 6 21:41:59 CET 2015

#1823: vcl in discarded mode does not clear up
 Reporter:  hamed.gholamian  |       Owner:
     Type:  defect           |      Status:  new
 Priority:  normal           |   Milestone:
Component:  varnishd         |     Version:  4.1.0
 Severity:  normal           |  Resolution:
 Keywords:                   |

Comment (by nan0r):

 As promised and discussed on IRC, this is a plan to reproduce the issue
 with a minimum amount of steps, from a clean environnement (in this
 example a fresh docker container, running ubuntu:latest image). Please
 note we don't need to "reload" varnish to see the "ref count" issue. At
 the end of these, netstat -na is empty, and varnishadm still shows a
 number of references attached to the boot config. sysctl -w
 net.ipv4.tcp_keepalive_time=15 is there only to clean the dying tcp
 connetions quicker for the end of the test.

 * reproduce from scratch, minimal
 ## just to earn some time, reduce tcp keep alive to 15 on the host
 # sysctl -w net.ipv4.tcp_keepalive_time=15
 # fresh minimal ubuntu 14.04 install (docker run -it ubuntu), image
 # docker run -it ubuntu
 # (from now, we are running command from the fresh ubuntu environnement)
 # install varnish and apache bench (ab)
  apt-get -y install apt-transport-https curl apache2-utils
  curl https://repo.varnish-cache.org/GPG-key.txt | apt-key add -
  echo "deb https://repo.varnish-cache.org/ubuntu/ trusty varnish-4.1" >>
  apt-get update
  apt-get -y install varnish
 # check version varnish
  varnishd -V | grep rev
 # varnishd (varnish-4.1.0 revision 3041728)
 ### setup mini config with backend not reachable
   echo "vcl 4.0;" > /etc/varnish/default.vcl
   echo "backend nonaccessible_backend { ">> /etc/varnish/default.vcl
   echo ".host = \"\" ;" >> /etc/varnish/default.vcl
   echo ".port = \"80\";" >> /etc/varnish/default.vcl
   echo "}" >> /etc/varnish/default.vcl
 # start varnish
  /etc/init.d/varnish start
  sleep 3
 # show number ref count before
  varnishadm vcl.list
  ab -n 100000 -c 1000 &
  sleep 5
  kill $!
  varnishadm vcl.list
 # wait keepalive trigger and clean dead tcp connection
 # count nomber of tcp tuples in netstat
  netstat -nat | grep tcp
 # wait the netstat to be cleared
  sleep 20
 # from now netstat should be empty from closing conenctions
 netstat -nat | grep -c CLOSE_WAIT
 # = 0, nothing left
 netstat -nat | wc -l
 # =6
 # refcount still high
  varnishadm vcl.list
 # active     auto/warm     957 boot

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

More information about the varnish-bugs mailing list