r4326 - in branches/2.0/varnish-cache: bin/varnishd include

tfheen at projects.linpro.no tfheen at projects.linpro.no
Tue Oct 13 11:23:25 CEST 2009


Author: tfheen
Date: 2009-10-13 11:23:25 +0200 (Tue, 13 Oct 2009)
New Revision: 4326

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



Modified: branches/2.0/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/cache_fetch.c	2009-10-13 09:05:12 UTC (rev 4325)
+++ branches/2.0/varnish-cache/bin/varnishd/cache_fetch.c	2009-10-13 09:23:25 UTC (rev 4326)
@@ -70,8 +70,11 @@
 
 	while (cl > 0) {
 		i = HTC_Read(htc, p, cl);
-		if (i <= 0)
+		if (i <= 0) {
+			WSP(sp, SLT_FetchError,
+			    "straight read_error: %d", errno);
 			return (-1);
+		}
 		p += i;
 		cl -= i;
 	}
@@ -110,8 +113,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
@@ -128,8 +134,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;
 		}
@@ -241,8 +250,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: branches/2.0/varnish-cache/include/shmlog_tags.h
===================================================================
--- branches/2.0/varnish-cache/include/shmlog_tags.h	2009-10-13 09:05:12 UTC (rev 4325)
+++ branches/2.0/varnish-cache/include/shmlog_tags.h	2009-10-13 09:23:25 UTC (rev 4326)
@@ -56,8 +56,6 @@
 SLTM(Backend)
 SLTM(Length)
 
-SLTM(FetchError)
-
 SLTM(RxRequest)
 SLTM(RxResponse)
 SLTM(RxStatus)
@@ -103,3 +101,5 @@
 SLTM(Hash)
 
 SLTM(Backend_health)
+
+SLTM(FetchError)



More information about the varnish-commit mailing list