[PATCH] Don't forget to do the stats when a request is aborted

Rogier 'DocWilco' Mulhuijzen github at bsdchicks.com
Wed Jan 18 19:03:42 CET 2012


Without doing SES_Charge, the worker will panic at the end of
CNT_Session() when a request is aborted before it is complete.

Found by: Federico G. Schwindt <fgsch at lodoss.net>
---
 bin/varnishd/cache/cache_center.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c
index a9c233b..b03ba4b 100644
--- a/bin/varnishd/cache/cache_center.c
+++ b/bin/varnishd/cache/cache_center.c
@@ -139,10 +139,12 @@ cnt_wait(struct sess *sp, struct worker *wrk, struct req *req)
 			break;
 		}
 		if (i == -1) {
+			SES_Charge(sp);
 			SES_Delete(sp, "EOF", now);
 			return (1);
 		}
 		if (i == -2) {
+			SES_Charge(sp);
 			SES_Delete(sp, "overflow", now);
 			return (1);
 		}
@@ -150,6 +152,7 @@ cnt_wait(struct sess *sp, struct worker *wrk, struct req *req)
 			/* Nothing but whitespace */
 			when = sp->t_idle + cache_param->timeout_idle;
 			if (when < now) {
+				SES_Charge(sp);
 				SES_Delete(sp, "timeout", now);
 				return (1);
 			}
@@ -168,6 +171,7 @@ cnt_wait(struct sess *sp, struct worker *wrk, struct req *req)
 			when = sp->t_req + cache_param->timeout_req;
 			tmo = (int)(1e3 * (when - now));
 			if (when < now || tmo == 0) {
+				SES_Charge(sp);
 				SES_Delete(sp, "req timeout", now);
 				return (1);
 			}
-- 
1.7.5.4




More information about the varnish-dev mailing list