r3530 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Mon Jan 19 13:58:44 CET 2009


Author: phk
Date: 2009-01-19 13:58:44 +0100 (Mon, 19 Jan 2009)
New Revision: 3530

Modified:
   trunk/varnish-cache/bin/varnishd/cache_center.c
   trunk/varnish-cache/bin/varnishd/cache_fetch.c
   trunk/varnish-cache/bin/varnishd/cache_http.c
   trunk/varnish-cache/bin/varnishd/cache_pipe.c
Log:
Be much more BOFH about bereq, more asserts, free them where they
obviously should be freed.

This could fix 421 or make it much worse, but give us more info.



Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c	2009-01-19 12:57:25 UTC (rev 3529)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c	2009-01-19 12:58:44 UTC (rev 3530)
@@ -155,6 +155,8 @@
 	CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);
 	CHECK_OBJ_NOTNULL(sp->vcl, VCL_CONF_MAGIC);
 
+	AZ(sp->bereq);
+
 	sp->t_resp = TIM_real();
 	if (sp->obj->objhead != NULL) {
 		sp->obj->last_use = sp->t_resp;	/* XXX: locking ? */
@@ -301,6 +303,7 @@
 	char date[40];
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+	AZ(sp->bereq);
 
 	/* We always close when we take this path */
 	sp->doclose = "error";
@@ -663,6 +666,7 @@
 		sp->step = STP_FETCH;
 		return (0);
 	case VCL_RET_RESTART:
+		VBE_free_bereq(&sp->bereq);
 		INCOMPL();
 	default:
 		WRONG("Illegal action in vcl_miss{}");
@@ -713,6 +717,7 @@
 
 	VCL_pass_method(sp);
 	if (sp->handling == VCL_RET_ERROR) {
+		VBE_free_bereq(&sp->bereq);
 		sp->step = STP_ERROR;
 		return (0);
 	}
@@ -769,6 +774,7 @@
 	assert(sp->handling == VCL_RET_PIPE);
 
 	PipeSession(sp);
+	AZ(sp->bereq);
 	AZ(sp->wrk->wfd);
 	sp->step = STP_DONE;
 	return (0);

Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c	2009-01-19 12:57:25 UTC (rev 3529)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c	2009-01-19 12:58:44 UTC (rev 3530)
@@ -324,6 +324,7 @@
 	CHECK_OBJ_NOTNULL(sp->bereq, BEREQ_MAGIC);
 	AN(sp->director);
 	AN(sp->obj->busy);
+	AN(sp->bereq);
 	w = sp->wrk;
 	bereq = sp->bereq;
 	hp = bereq->http;

Modified: trunk/varnish-cache/bin/varnishd/cache_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_http.c	2009-01-19 12:57:25 UTC (rev 3529)
+++ trunk/varnish-cache/bin/varnishd/cache_http.c	2009-01-19 12:58:44 UTC (rev 3530)
@@ -634,6 +634,7 @@
 	struct bereq *bereq;
 	struct http *hp;
 
+	AZ(sp->bereq);
 	bereq = VBE_new_bereq();
 	AN(bereq);
 	hp = bereq->http;

Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pipe.c	2009-01-19 12:57:25 UTC (rev 3529)
+++ trunk/varnish-cache/bin/varnishd/cache_pipe.c	2009-01-19 12:58:44 UTC (rev 3530)
@@ -90,14 +90,15 @@
 		sp->acct_req.bodybytes +=
 		    WRW_Write(w, sp->htc->pipeline.b, Tlen(sp->htc->pipeline));
 
-	if (WRW_FlushRelease(w)) {
+	i = WRW_FlushRelease(w);
+	VBE_free_bereq(&bereq);
+
+	if (i) {
 		vca_close_session(sp, "pipe");
 		VBE_ClosedFd(sp);
 		return;
 	}
 
-	VBE_free_bereq(&bereq);
-
 	sp->t_resp = TIM_real();
 
 	memset(fds, 0, sizeof fds);



More information about the varnish-commit mailing list