Gaute Amundsen <[EMAIL PROTECTED]> writes:
> I was finding quite a bit of "Pipe Shut" just running varnishlog -o.
> I's out of my buffer, so I cant paste it in right now, but could it
> bee that I was opening to many pipes?

"pipe shut" happens when either the backend or the client closes the
connection, although there is a possibility that the code (rdf() in
cache_pipe.c) is too sensitive and shuts down the pipe as soon as the
client's TCP window fills up.  Could you try the attached patch?

DES
-- 
Dag-Erling Smørgrav
Senior Software Developer
Linpro AS - www.linpro.no

Index: bin/varnishd/cache_pipe.c
===================================================================
--- bin/varnishd/cache_pipe.c	(revision 1627)
+++ bin/varnishd/cache_pipe.c	(working copy)
@@ -50,7 +50,7 @@
 rdf(struct pollfd *fds, int idx)
 {
 	int i, j;
-	char buf[BUFSIZ];
+	char buf[BUFSIZ], *p;
 
 	i = read(fds[idx].fd, buf, sizeof buf);
 	if (i <= 0 || fds[1-idx].events == 0) {
@@ -60,13 +60,16 @@
 		shutdown(fds[1-idx].fd, SHUT_WR);
 		fds[idx].events = 0;
 	} else {
-		j = write(fds[1-idx].fd, buf, i);
-		if (i != j) {
-			VSL(SLT_Debug, fds[idx].fd, "Pipe Shut write(write)");
-			VSL(SLT_Debug, fds[1-idx].fd, "Pipe Shut read(write)");
-			shutdown(fds[idx].fd, SHUT_WR);
-			shutdown(fds[1-idx].fd, SHUT_RD);
-			fds[1-idx].events = 0;
+		for (p = buf; i > 0; i -= j, p += j) {
+			j = write(fds[1-idx].fd, p, i);
+			if (j < 0) {
+				VSL(SLT_Debug, fds[idx].fd, "Pipe Shut write(write)");
+				VSL(SLT_Debug, fds[1-idx].fd, "Pipe Shut read(write)");
+				shutdown(fds[idx].fd, SHUT_WR);
+				shutdown(fds[1-idx].fd, SHUT_RD);
+				fds[1-idx].events = 0;
+				break;
+			}
 		}
 	}
 }
_______________________________________________
varnish-misc mailing list
varnish-misc@projects.linpro.no
http://projects.linpro.no/mailman/listinfo/varnish-misc

Reply via email to