From: phk Date: Mon, 19 Jan 2009 12:58:44 +0000 (+0000) Subject: Be much more BOFH about bereq, more asserts, free them where they X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d3f167a487a707a408f9f5cc93757ec2e9453369;p=varnish 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. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3530 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache_center.c b/varnish-cache/bin/varnishd/cache_center.c index f2445649..437acb8e 100644 --- a/varnish-cache/bin/varnishd/cache_center.c +++ b/varnish-cache/bin/varnishd/cache_center.c @@ -155,6 +155,8 @@ cnt_deliver(struct sess *sp) 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 @@ cnt_error(struct sess *sp) 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 @@ cnt_miss(struct sess *sp) 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 @@ cnt_pass(struct sess *sp) 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 @@ cnt_pipe(struct sess *sp) assert(sp->handling == VCL_RET_PIPE); PipeSession(sp); + AZ(sp->bereq); AZ(sp->wrk->wfd); sp->step = STP_DONE; return (0); diff --git a/varnish-cache/bin/varnishd/cache_fetch.c b/varnish-cache/bin/varnishd/cache_fetch.c index ec6a9e6a..cc7566eb 100644 --- a/varnish-cache/bin/varnishd/cache_fetch.c +++ b/varnish-cache/bin/varnishd/cache_fetch.c @@ -324,6 +324,7 @@ Fetch(struct sess *sp) 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; diff --git a/varnish-cache/bin/varnishd/cache_http.c b/varnish-cache/bin/varnishd/cache_http.c index 19d29cd2..558daa00 100644 --- a/varnish-cache/bin/varnishd/cache_http.c +++ b/varnish-cache/bin/varnishd/cache_http.c @@ -634,6 +634,7 @@ http_FilterHeader(struct sess *sp, unsigned how) struct bereq *bereq; struct http *hp; + AZ(sp->bereq); bereq = VBE_new_bereq(); AN(bereq); hp = bereq->http; diff --git a/varnish-cache/bin/varnishd/cache_pipe.c b/varnish-cache/bin/varnishd/cache_pipe.c index 4ae3f83b..eb725a3c 100644 --- a/varnish-cache/bin/varnishd/cache_pipe.c +++ b/varnish-cache/bin/varnishd/cache_pipe.c @@ -90,14 +90,15 @@ PipeSession(struct sess *sp) 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);