[Varnish] #1799: Backend request coalescing fail
Varnish
varnish-bugs at varnish-cache.org
Thu Oct 8 17:00:42 CEST 2015
#1799: Backend request coalescing fail
--------------------+---------------------
Reporter: martin | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: build | Version: unknown
Severity: normal | Keywords:
--------------------+---------------------
See attached test case.
If we have a busy (flag OC_F_BUSY set) OC on the object head during
HSH_Lookup, and there is an expired candidate available, the request won't
be put on waitinglist but return with the expired OC. If this OC is
rejected by the VCL (return(miss) from vcl_hit), the request is turned
into a pass to the backend. This is logged SLT_VCL_Error: "vcl_hit{}
returns fetch without busy object. Doing pass").
If e.g. Varnish is configured to not use grace but with keep (for IMS
against the backend), this happens just after the TTL of the object has
expired. There is an expired object available, but not within grace, and
all requests except the one that inserted the OC_F_BUSY will become passes
to the backend until the OC_F_BUSY flag is removed. The attached test case
covers this.
Another scenario that will exhibit this is when you have a large grace
period, but differentiate on how big grace you accept in vcl_hit based on
the backend health status. If your object was not refreshed during the
healthy backend shorter grace window, you'll get one backend request for
each client request until the backend answers (slow backends suffer more).
The expected outcome in my opinion is that the requests should have been
placed on the waitinglist of the object head until the time the OC_F_BUSY
flag is gone.
I've been pondering how to fix this. But all attempts at reentering the
waitinglist on the OH after HSH_Lookup has completed seems to open race
conditions. The only sane way to fix this that I can see is to reintroduce
the req.grace attribute, and move the graceability of the expired object
back into the HSH_Lookup object head mutex critical region.
Martin
--
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1799>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator
More information about the varnish-bugs
mailing list