varnish 2.1.5 assert error in http_SetH()

YABUKI Youichi yabuki at sraoss.co.jp
Tue Aug 13 06:52:30 CEST 2013


My customers varnish 2.1.5 aborted with Assert error in http_SetH().
The related logs in /var/log/messages are as follow.

This problem seems like #726.
https://www.varnish-cache.org/lists/pipermail/varnish-bugs/2010-June/002888.html
The page says this is fixed in trunk, but I cannot find the fix for 2.1.5.
Is my fix bellow OK?

/var/log/messages:
-----------------------------------------------------------------------------
Jul 25 06:12:22 XXXXXXXXXX varnishd[4883]: Child (4898) died signal=6
Jul 25 06:12:22 XXXXXXXXXX varnishd[4883]: Child (4898) Panic message: Assert error in http_SetH(), cache_http.c line 656:   Condition((fm) != 0) not true. thread = (cache-worker) ident = Linux,2.6.18-194.el5,x86_64,-sfile,-hclassic,epoll Backtrace:   0x42bad9: pan_backtrace+16   0x42bd42: pan_ic+164   0x427006: http_SetH+81   0x4352ac: VRT_l_obj_status+d8   0x2acd5b411ce5: _end+2acd5ad8547d   0x2acd5b414cac: _end+2acd5ad88444   0x4328cf: VCL_error_method+6a   0x4150eb: cnt_error+2fa   0x418558: CNT_Session+5e1   0x42d7e9: wrk_do_cnt_sess+12a sp = 0x2acd57f02008 {   fd = 20, id = 20, xid = 4240864234,   client = XX.XX.XX.XX 46773,   step = STP_ERROR,   handling = deliver,   err_code = 854, err_reason = redirection,   restarts = 0, esis = 0   ws = 0x2acd57f02080 {      id = "sess",     {s,f,r,e} = {0x2acd57f02cd8,+1464,(nil),+131072},   },   http[req] = {     ws = 0x2acd57f02080[sess]       "GET",       "/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 X!
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Jul 25 06:12:22 XXXXXXXXXX varnishd[4883]: Child cleanup complete
Jul 25 06:12:22 XXXXXXXXXX varnishd[4883]: child (2652) Started
Jul 25 06:12:22 XXXXXXXXXX varnishd[4883]: Child (2652) said 
Jul 25 06:12:22 XXXXXXXXXX varnishd[4883]: Child (2652) said Child starts
Jul 25 06:12:22 XXXXXXXXXX varnishd[4883]: Child (2652) said managed to mmap 107374182400 bytes of 107374182400
-----------------------------------------------------------------------------

patch:
-----------------------------------------------------------------------------
--- cache_vrt.c.org	2013-08-07 13:00:12.000000000 +0900
+++ cache_vrt.c	2013-08-08 10:36:24.000000000 +0900
@@ -275,12 +275,13 @@ VRT_l_obj_status(const struct sess *sp, 
 
 	assert(num >= 100 && num <= 999);
 	p = WS_Alloc(sp->obj->http->ws, 4);
-	if (p == NULL)
+	if (p == NULL) {
 		WSP(sp, SLT_LostHeader, "%s", "obj.status");
-	else
+	} else {
 		sprintf(p, "%d", num);
-	http_SetH(sp->obj->http, HTTP_HDR_STATUS, p);
-	sp->obj->http->status = num;
+		http_SetH(sp->obj->http, HTTP_HDR_STATUS, p);
+		sp->obj->http->status = num;
+	}
 }
 
 /* Add an objecthead to the saintmode list for the (hopefully) relevant
@@ -356,12 +357,13 @@ VRT_l_resp_status(const struct sess *sp,
 
 	assert(num >= 100 && num <= 999);
 	p = WS_Alloc(sp->wrk->ws, 4);
-	if (p == NULL)
+	if (p == NULL) {
 		WSP(sp, SLT_LostHeader, "%s", "resp.status");
-	else
+	} else {
 		sprintf(p, "%d", num);
-	http_SetH(sp->wrk->resp, HTTP_HDR_STATUS, p);
-	sp->wrk->resp->status = num;
+		http_SetH(sp->wrk->resp, HTTP_HDR_STATUS, p);
+		sp->wrk->resp->status = num;
+	}
 }
 
 int
@@ -461,12 +463,13 @@ VRT_l_beresp_status(const struct sess *s
 
 	assert(num >= 100 && num <= 999);
 	p = WS_Alloc(sp->wrk->beresp->ws, 4);
-	if (p == NULL)
+	if (p == NULL) {
 		WSP(sp, SLT_LostHeader, "%s", "obj.status");
-	else
+	} else {
 		sprintf(p, "%d", num);
-	http_SetH(sp->wrk->beresp, HTTP_HDR_STATUS, p);
-	sp->wrk->beresp->status = num;
+		http_SetH(sp->wrk->beresp, HTTP_HDR_STATUS, p);
+		sp->wrk->beresp->status = num;
+	}
 }
 
 int


-----------------------------------------------------------------------------
yabuki at sraoss.co.jp
SRA OSS,Inc.Japan




More information about the varnish-bugs mailing list