[experimental-ims] 23cffba Check that workspace_backend is big enough, rather than run on the mercy of mallocs rounding algorithm.

Geoff Simmons geoff at varnish-cache.org
Tue Feb 14 17:49:34 CET 2012


commit 23cffba4d1fc94bb765c30c6271a52f52691689e
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Feb 13 11:07:55 2012 +0000

    Check that workspace_backend is big enough, rather than run on the
    mercy of mallocs rounding algorithm.
    
    Fix overly optimistictest-case.

diff --git a/bin/varnishd/cache/cache_busyobj.c b/bin/varnishd/cache/cache_busyobj.c
index 3a60bfd..0252d57 100644
--- a/bin/varnishd/cache/cache_busyobj.c
+++ b/bin/varnishd/cache/cache_busyobj.c
@@ -127,6 +127,11 @@ VBO_GetBusyObj(struct worker *wrk)
 	p += httpsz;
 	vbo->bo.beresp = HTTP_create(p, nhttp);
 	p += httpsz;
+	if (p >= vbo->end) {
+		fprintf(stderr, "workspace_backend is at least %jd to small\n",
+		    (p - vbo->end));
+		assert (p < vbo->end);
+	}
 	WS_Init(vbo->bo.ws, "bo", p, vbo->end - p);
 
 	return (&vbo->bo);
diff --git a/bin/varnishtest/tests/r01038.vtc b/bin/varnishtest/tests/r01038.vtc
index ff94c72..cecb009 100644
--- a/bin/varnishtest/tests/r01038.vtc
+++ b/bin/varnishtest/tests/r01038.vtc
@@ -45,7 +45,7 @@ server s1 {
 	txresp -body "foo8"
 } -start
 
-varnish v1 -arg "-p workspace_backend=1024" -vcl+backend {
+varnish v1 -arg "-p workspace_backend=3072" -vcl+backend {
 	sub vcl_fetch {
 		set beresp.do_esi = true;
 	}
@@ -54,8 +54,11 @@ varnish v1 -arg "-p workspace_backend=1024" -vcl+backend {
 client c1 {
 	txreq
 	rxresp
+	expect resp.bodylen == 42
+
 	txreq
 	rxresp
+	expect resp.bodylen == 42
 } -run
 
 varnish v1 -expect losthdr == 0



More information about the varnish-commit mailing list