[master] 16df092f2 Add ws_client_overflow counter

Dag Haavi Finstad daghf at varnish-software.com
Fri Oct 12 14:52:09 UTC 2018


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

    Add ws_client_overflow counter

diff --git a/bin/varnishd/VSC_main.vsc b/bin/varnishd/VSC_main.vsc
index d73b84102..e7b7b9dcf 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 c7d1ad32e..50f9dd760 100644
--- a/bin/varnishd/http2/cache_http2_deliver.c
+++ b/bin/varnishd/http2/cache_http2_deliver.c
@@ -273,6 +273,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
diff --git a/bin/varnishtest/tests/v00058.vtc b/bin/varnishtest/tests/v00058.vtc
index 96c3972ef..e9869c29e 100644
--- a/bin/varnishtest/tests/v00058.vtc
+++ b/bin/varnishtest/tests/v00058.vtc
@@ -166,3 +166,4 @@ client c1 {
 } -run
 
 varnish v1 -expect client_resp_500 == 1
+varnish v1 -expect ws_client_overflow == 2


More information about the varnish-commit mailing list