[Varnish] #1696: Varnish leaves connections in CLOSE_WAIT
Varnish
varnish-bugs at varnish-cache.org
Wed Apr 1 13:13:52 CEST 2015
#1696: Varnish leaves connections in CLOSE_WAIT
----------------------+----------------------
Reporter: rwimmer | Owner:
Type: defect | Status: closed
Priority: high | Milestone:
Component: build | Version: 3.0.5
Severity: critical | Resolution: invalid
Keywords: |
----------------------+----------------------
Changes (by daghf):
* status: new => closed
* resolution: => invalid
Comment:
Hi
What happens here is sessions piling up in the waitinglists, due to
backend request serialization caused by a vcl_fetch misconfiguration.
On a cache miss, Varnish will kick off a backend request, and any
subsequent request for that object while it is being fetched will be
waitlisted, on the premise that the response from the request that was
first kicked off is indeed cacheable and can thus also be delivered to the
waiting clients.
To avoid waitlisting for non-cacheable resources, Varnish has the concept
of hit_for_pass, which basically means that we cache the decision not to
cache this object - and thus don't do any waitlisting/request coalescing.
However, a hit_for_pass object also carries a TTL, and if that TTL was set
to 0s, it is immediately timed out and we're back to queueing up requests
(for a resources that is not cacheable), and thus they will be dispatched
in a serialized manner, one at the time. In a situation where the incoming
request rate is higher than the rate that they are dispatched to the
backend, you will then see a pileup of sessions stuck in the waiting
lists.
The built-in VCL has safeguards to prevent this (if the ttl was set to 0s
it will create a 120s hit_for_pass object), but when an explicit return is
done that prevents the built-in VCL from executing.
Summary: If you do an explicit return from vcl_fetch, make sure beresp.ttl
is different from 0s.
--
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1696#comment:3>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator
More information about the varnish-bugs
mailing list