Skip to content
This repository has been archived by the owner on Jul 30, 2021. It is now read-only.

Commit

Permalink
The ESI_VDP would double-close sessions when a flush error happened
Browse files Browse the repository at this point in the history
before an ESI include at one level, and then again at a higher level.

Fixed by not closing the session in this case, as that will be taken
care of at the end of delivery anyways when V1L_FlushRelease is
called.

Fixes: 		#1737
Submitted by:	Martin
  • Loading branch information
bsdphk committed Aug 10, 2015
1 parent 891889f commit 9cd4a90
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
1 change: 0 additions & 1 deletion bin/varnishd/cache/cache_esi_deliver.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv,
r = (void*)strchr((const char*)q, '\0');
AN(r);
if (VDP_bytes(req, VDP_FLUSH, NULL, 0)) {
SES_Close(req->sp, SC_REM_CLOSE);
ecx->p = ecx->e;
break;
}
Expand Down
43 changes: 43 additions & 0 deletions bin/varnishtest/tests/r01737.vtc
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
varnishtest "#1737 - ESI sublevel session close"

# Build a esi request tree that fails on flush before include at two different
# levels. Synchronize a client close after the response headers have been
# received by the client. This produces write erros for the body parts in all
# fragments.
server s1 {
rxreq
txresp -body {<esi:include src="/bar"/><esi:include src="/bar"/>}
sema r1 sync 2

rxreq
delay 1
txresp -body {<esi:include src="/baz"/>22<esi:include src="/baz"/>}

rxreq
txresp -body {1}

rxreq
expect req.url == "/check"
rxresp
} -start

varnish v1 -vcl+backend {
sub vcl_backend_response {
set beresp.do_esi = true;
}
} -start

# Send request, read response headers then close connection
client c1 {
txreq
rxresp -no_obj
sema r1 sync 2
} -run

delay 3

# Check that Varnish is alive
client c1 {
txreq
rxresp
} -run

0 comments on commit 9cd4a90

Please sign in to comment.