r4232 - in trunk/varnish-cache: bin/varnishd include

phk at projects.linpro.no phk at projects.linpro.no
Tue Sep 8 14:07:02 CEST 2009


Author: phk
Date: 2009-09-08 14:07:02 +0200 (Tue, 08 Sep 2009)
New Revision: 4232

Modified:
   trunk/varnish-cache/bin/varnishd/cache_fetch.c
   trunk/varnish-cache/include/shmlog_tags.h
Log:
Add a new SHMLOG tag FetchError and record why a backend fetch croaked.



Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c	2009-09-08 11:35:39 UTC (rev 4231)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c	2009-09-08 12:07:02 UTC (rev 4232)
@@ -73,8 +73,11 @@
 
 		while (sl > 0) {
 			i = HTC_Read(htc, p, sl);
-			if (i <= 0)
+			if (i <= 0) {
+				WSP(sp, SLT_FetchError,
+				    "straight read_error: %d", errno);
 				return (-1);
+			}
 			p += i;
 			st->len += i;
 			sp->obj->len += i;
@@ -117,8 +120,11 @@
 
 		/* If we didn't succeed, add to buffer, try again */
 		if (q == NULL || q == buf || *q != '\n') {
-			if (bp >= be)
+			if (bp >= be) {
+				WSP(sp, SLT_FetchError,
+				    "chunked hex-line too long");
 				return (-1);
+			}
 			/*
 			 * The semantics we need here is "read until you have
 			 * received at least one character, but feel free to
@@ -135,8 +141,11 @@
 			 * at a time.
 			 */
 			i = HTC_Read(htc, bp, 1);
-			if (i <= 0)
+			if (i <= 0) {
+				WSP(sp, SLT_FetchError,
+				    "chunked read_error: %d", errno);
 				return (-1);
+			}
 			bp += i;
 			continue;
 		}
@@ -248,8 +257,11 @@
 		AN(p);
 		AN(st);
 		i = HTC_Read(htc, p, v);
-		if (i < 0)
+		if (i < 0) {
+			WSP(sp, SLT_FetchError,
+			    "eof read_error: %d", errno);
 			return (-1);
+		}
 		if (i == 0)
 			break;
 		p += i;

Modified: trunk/varnish-cache/include/shmlog_tags.h
===================================================================
--- trunk/varnish-cache/include/shmlog_tags.h	2009-09-08 11:35:39 UTC (rev 4231)
+++ trunk/varnish-cache/include/shmlog_tags.h	2009-09-08 12:07:02 UTC (rev 4232)
@@ -55,6 +55,8 @@
 SLTM(Backend)
 SLTM(Length)
 
+SLTM(FetchError)
+
 SLTM(RxRequest)
 SLTM(RxResponse)
 SLTM(RxStatus)



More information about the varnish-commit mailing list