[master] e06d5dc Don't attempt to allocate a V1L from the workspace if it is overflowed.

Poul-Henning Kamp phk at FreeBSD.org
Fri Oct 30 11:27:20 CET 2015


commit e06d5dc0804ce7e81ccee7a5b95459c5564a196a
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri Oct 30 10:26:29 2015 +0000

    Don't attempt to allocate a V1L from the workspace if it is overflowed.
    
    Fixes:	#1796
    Also triggered by:	The Wemm-Field

diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c
index 997d28b..0135ed8 100644
--- a/bin/varnishd/http1/cache_http1_deliver.c
+++ b/bin/varnishd/http1/cache_http1_deliver.c
@@ -112,10 +112,12 @@ V1D_Deliver(struct req *req, struct busyobj *bo, int sendbody)
 	if (sendbody && req->resp_len != 0)
 		VDP_push(req, v1d_bytes, NULL, 1);
 
+	AZ(req->wrk->v1l);
 	V1L_Reserve(req->wrk, req->ws, &req->sp->fd, req->vsl, req->t_prev);
 
 	if (WS_Overflowed(req->ws)) {
 		v1d_error(req, "workspace_client overflow");
+		AZ(req->wrk->v1l);
 		return;
 	}
 
@@ -134,5 +136,6 @@ V1D_Deliver(struct req *req, struct busyobj *bo, int sendbody)
 
 	if ((V1L_FlushRelease(req->wrk) || ois != OIS_DONE) && req->sp->fd >= 0)
 		SES_Close(req->sp, SC_REM_CLOSE);
+	AZ(req->wrk->v1l);
 	VDP_close(req);
 }
diff --git a/bin/varnishd/http1/cache_http1_line.c b/bin/varnishd/http1/cache_http1_line.c
index 9c49fca..9f13543 100644
--- a/bin/varnishd/http1/cache_http1_line.c
+++ b/bin/varnishd/http1/cache_http1_line.c
@@ -78,6 +78,8 @@ V1L_Reserve(struct worker *wrk, struct ws *ws, int *fd, struct vsl_log *vsl,
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
 	AZ(wrk->v1l);
 
+	if (WS_Overflowed(ws))
+		return;
 	res = WS_Snapshot(ws);
 	v1l = WS_Alloc(ws, sizeof *v1l);
 	if (v1l == NULL)



More information about the varnish-commit mailing list