[6.0] 9418297fe Add ws_client_overflow counter

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Wed Oct 31 13:08:31 UTC 2018


commit 9418297fe07a0ae49d5669328da203419625ffa3
Author: Dag Haavi Finstad <daghf at varnish-software.com>
Date:   Thu Oct 11 11:26:45 2018 +0200

    Add ws_client_overflow counter
    
    Conflicts:
            bin/varnishtest/tests/v00058.vtc

diff --git a/bin/varnishd/VSC_main.vsc b/bin/varnishd/VSC_main.vsc
index f640f1ff5..3327eb095 100644
--- a/bin/varnishd/VSC_main.vsc
+++ b/bin/varnishd/VSC_main.vsc
@@ -601,6 +601,13 @@
 
 	Number of times we ran out of space in workspace_backend.
 
+.. varnish_vsc:: ws_client_overflow
+	:level: diag
+	:group: wrk
+	:oneliner: workspace_client overflows
+
+	Number of times we ran out of space in workspace_client.
+
 .. varnish_vsc:: shm_records
 	:level:	diag
 	:oneliner:	SHM records
diff --git a/bin/varnishd/cache/cache_req.c b/bin/varnishd/cache/cache_req.c
index 991487201..5ab13a2cf 100644
--- a/bin/varnishd/cache/cache_req.c
+++ b/bin/varnishd/cache/cache_req.c
@@ -191,6 +191,8 @@ Req_Rollback(struct req *req)
 	VCL_TaskLeave(req->vcl, req->privs);
 	VCL_TaskEnter(req->vcl, req->privs);
 	HTTP_Copy(req->http, req->http0);
+	if (WS_Overflowed(req->ws))
+		req->wrk->stats->ws_client_overflow++;
 	WS_Reset(req->ws, req->ws_req);
 }
 
@@ -242,6 +244,9 @@ Req_Cleanup(struct sess *sp, struct worker *wrk, struct req *req)
 	req->hash_ignore_busy = 0;
 	req->is_hit = 0;
 
+	if (WS_Overflowed(req->ws))
+		wrk->stats->ws_client_overflow++;
+
 	WS_Reset(req->ws, 0);
 }
 
diff --git a/bin/varnishd/http2/cache_http2_deliver.c b/bin/varnishd/http2/cache_http2_deliver.c
index de55887ae..2ec67a60b 100644
--- a/bin/varnishd/http2/cache_http2_deliver.c
+++ b/bin/varnishd/http2/cache_http2_deliver.c
@@ -262,6 +262,7 @@ h2_deliver(struct req *req, struct boc *boc, int sendbody)
 		VSB_bcat(&resp, r, sz);
 	}
 	if (VSB_finish(&resp)) {
+		WS_MarkOverflow(req->ws);
 		// We ran out of workspace, return minimal 500
 		VSLb(req->vsl, SLT_Error, "workspace_client overflow");
 		VSLb(req->vsl, SLT_RespStatus, "500");
diff --git a/bin/varnishtest/tests/c00070.vtc b/bin/varnishtest/tests/c00070.vtc
index 4ecf82671..9042fc554 100644
--- a/bin/varnishtest/tests/c00070.vtc
+++ b/bin/varnishtest/tests/c00070.vtc
@@ -69,3 +69,4 @@ client c1 {
 logexpect l2 -wait
 
 varnish v1 -expect client_resp_500 == 1
+varnish v1 -expect ws_client_overflow == 2
diff --git a/bin/varnishtest/tests/c00071.vtc b/bin/varnishtest/tests/c00071.vtc
index 8ebddc490..6cff35d87 100644
--- a/bin/varnishtest/tests/c00071.vtc
+++ b/bin/varnishtest/tests/c00071.vtc
@@ -48,3 +48,4 @@ client c2 {
 
 
 varnish v1 -expect client_resp_500 == 2
+varnish v1 -expect ws_client_overflow == 2
diff --git a/bin/varnishtest/tests/r02233.vtc b/bin/varnishtest/tests/r02233.vtc
index fe36fccb2..2bc591b82 100644
--- a/bin/varnishtest/tests/r02233.vtc
+++ b/bin/varnishtest/tests/r02233.vtc
@@ -29,3 +29,4 @@ client c1 {
 
 logexpect l1 -wait
 varnish v1 -expect client_resp_500 == 1
+varnish v1 -expect ws_client_overflow == 1
diff --git a/bin/varnishtest/tests/r02589.vtc b/bin/varnishtest/tests/r02589.vtc
index 2c43ab6fc..0d39c4fb3 100644
--- a/bin/varnishtest/tests/r02589.vtc
+++ b/bin/varnishtest/tests/r02589.vtc
@@ -29,3 +29,4 @@ client c1 {
 } -run
 
 varnish v1 -expect client_resp_500 == 1
+varnish v1 -expect ws_client_overflow == 1


More information about the varnish-commit mailing list