r4233 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Tue Sep 8 14:24:40 CEST 2009


Author: phk
Date: 2009-09-08 14:24:40 +0200 (Tue, 08 Sep 2009)
New Revision: 4233

Modified:
   trunk/varnish-cache/bin/varnishd/cache_fetch.c
Log:
Add SHMLOG records for more backend fetch failures



Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c	2009-09-08 12:07:02 UTC (rev 4232)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c	2009-09-08 12:24:40 UTC (rev 4233)
@@ -351,8 +351,10 @@
 	hp = sp->wrk->bereq;
 
 	VBE_GetFd(sp);
-	if (sp->vbe == NULL)
+	if (sp->vbe == NULL) {
+		WSP(sp, SLT_FetchError, "no backend connection");
 		return (__LINE__);
+	}
 	vc = sp->vbe;
 	/* Inherit the backend timeouts from the selected backend */
 	SES_InheritBackendTimeouts(sp);
@@ -372,6 +374,7 @@
 	/* Deal with any message-body the request might have */
 	i = FetchReqBody(sp);
 	if (WRW_FlushRelease(w) || i > 0) {
+		WSP(sp, SLT_FetchError, "backend write error: %d", errno);
 		VBE_ClosedFd(sp);
 		/* XXX: other cleanup ? */
 		return (__LINE__);
@@ -389,19 +392,21 @@
 	TCP_set_read_timeout(vc->fd, sp->first_byte_timeout);
 	do {
 		i = HTC_Rx(sp->wrk->htc);
+		if (i < 0) {
+			WSP(sp, SLT_FetchError,
+			    "http read error: %d", errno);
+			VBE_ClosedFd(sp);
+			/* XXX: other cleanup ? */
+			return (__LINE__);
+		}
 		TCP_set_read_timeout(vc->fd, sp->between_bytes_timeout);
 	}
 	while (i == 0);
 
-	if (i < 0) {
-		VBE_ClosedFd(sp);
-		/* XXX: other cleanup ? */
-		return (__LINE__);
-	}
-
 	hp = sp->wrk->beresp;
 
 	if (http_DissectResponse(sp->wrk, sp->wrk->htc, hp)) {
+		WSP(sp, SLT_FetchError, "http format error");
 		VBE_ClosedFd(sp);
 		/* XXX: other cleanup ? */
 		return (__LINE__);
@@ -552,5 +557,3 @@
 
 	CLI_AddFuncs(DEBUG_CLI, debug_cmds);
 }
-
-



More information about the varnish-commit mailing list