[3.0] 773d415 I have no idea how I ended up incrementting the fail counter by the size of the request, probably sleep copy&paste ?
Tollef Fog Heen
tfheen at varnish-cache.org
Mon Apr 22 13:26:59 CEST 2013
commit 773d4151c864fcca5a931995c8dba7c7318c18ae
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Jul 30 15:52:55 2012 +0000
I have no idea how I ended up incrementting the fail counter by the
size of the request, probably sleep copy&paste ?
Fixed #1175
Submitted by: martin
diff --git a/bin/varnishd/storage_malloc.c b/bin/varnishd/storage_malloc.c
index f72cd48..3450a76 100644
--- a/bin/varnishd/storage_malloc.c
+++ b/bin/varnishd/storage_malloc.c
@@ -67,7 +67,7 @@ sma_alloc(struct stevedore *st, size_t size)
Lck_Lock(&sma_sc->sma_mtx);
sma_sc->stats->c_req++;
if (sma_sc->sma_alloc + size > sma_sc->sma_max) {
- sma_sc->stats->c_fail += size;
+ sma_sc->stats->c_fail++;
size = 0;
} else {
sma_sc->sma_alloc += size;
diff --git a/bin/varnishtest/tests/r01175.vtc b/bin/varnishtest/tests/r01175.vtc
new file mode 100644
index 0000000..739c56a
--- /dev/null
+++ b/bin/varnishtest/tests/r01175.vtc
@@ -0,0 +1,20 @@
+varnishtest "#1175 - -smalloc c_fail incremented by bytes"
+
+server s1 {
+ rxreq
+ txresp -nolen -hdr "Content-Length: 1048576"
+} -start
+
+varnish v1 -storage "-s test=malloc,1M" -vcl+backend {
+ sub vcl_fetch {
+ set beresp.storage = "test";
+ }
+} -start
+
+client c1 {
+ txreq
+ rxresp
+ expect resp.status == 503
+} -run
+
+varnish v1 -expect SMA.test.c_fail < 5
More information about the varnish-commit
mailing list