]> err.no Git - varnish/commitdiff
Merge r3322 from trunk
authortfheen <tfheen@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 20 Oct 2008 08:55:24 +0000 (08:55 +0000)
committertfheen <tfheen@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 20 Oct 2008 08:55:24 +0000 (08:55 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/branches/2.0@3325 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_hash.c
varnish-cache/bin/varnishd/cache_vrt_esi.c
varnish-cache/bin/varnishtest/tests/r00345.vtc [new file with mode: 0644]

index ce6b7c0de69a8379deced846cbf798fa629a5b9e..7ef852cb2af08a31c42b7617df1192d3e1c99b90 100644 (file)
@@ -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);
index 8eb52aa3a2379c64871327e09e9a563399bda3d2..c497554605dc4391ffc6d8f322d6ffd306bbe7e1 100644 (file)
@@ -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;
 
diff --git a/varnish-cache/bin/varnishtest/tests/r00345.vtc b/varnish-cache/bin/varnishtest/tests/r00345.vtc
new file mode 100644 (file)
index 0000000..b39030c
--- /dev/null
@@ -0,0 +1,40 @@
+# $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
+