Commit ccaf7c7f authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

ESI includes can hit the waiting list and since the state is stored

on the worker thread stack, we cannot just let another thread pick
up.

This is not as much a fix as a workaround: simply sleep until the
object we wait for is no longer busy.

The issue may have to be revisited in the long run, but for 2.0.x
this will have to do.

Fixes #345



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@3322 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent c8c8590b
......@@ -266,7 +266,8 @@ HSH_Lookup(struct sess *sp)
if (busy_o != NULL) {
/* There are one or more busy objects, wait for them */
VTAILQ_INSERT_TAIL(&oh->waitinglist, sp, list);
if (sp->esis == 0)
VTAILQ_INSERT_TAIL(&oh->waitinglist, sp, list);
sp->objhead = oh;
UNLOCK(&oh->mtx);
return (NULL);
......
......@@ -796,7 +796,6 @@ VRT_ESI(struct sess *sp)
void
ESI_Deliver(struct sess *sp)
{
struct esi_bit *eb;
struct object *obj;
......@@ -839,7 +838,16 @@ ESI_Deliver(struct sess *sp)
sp->step = STP_RECV;
http_ForceGet(sp->http);
http_Unset(sp->http, H_Content_Length);
CNT_Session(sp);
while (1) {
CNT_Session(sp);
if (sp->step == STP_DONE)
break;
AN(sp->wrk);
WSL_Flush(sp->wrk, 0);
DSL(0x20, SLT_Debug, sp->id, "loop waiting for ESI");
usleep(10000);
}
assert(sp->step == STP_DONE);
sp->esis--;
sp->obj = obj;
......
# $Id$
test "#345, ESI waitinglist trouble"
server s1 {
rxreq
txresp -body {<esi:include src="someurl">}
rxreq
sema r1 sync 2
delay 1
txresp -body {DATA}
} -start
varnish v1 -arg "-p diag_bitmap=0x20" -vcl+backend {
sub vcl_fetch {
if (req.url == "/") {
esi;
}
}
} -start
client c1 {
txreq
rxresp
expect resp.bodylen == 4
} -start
client c2 {
txreq
sema r1 sync 2
rxresp
expect resp.bodylen == 4
} -run
client c1 {
txreq
rxresp
expect resp.bodylen == 4
} -run
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment