threads looping in PipeSession()

Michal Belczyk belczyk at bsd.krakow.pl
Tue Sep 25 14:04:08 CEST 2007


Hello,

while testing varnish I noticed several threads consuming 100% of the cpu
time:

shutdown(5221, 1 /* send */)            = 0
poll([{fd=5221, events=POLLIN|POLLERR}, {fd=5172, events=0,
revents=POLLHUP}], 2, 60000) = 1
read(5172, "", 8192)                    = 0
shutdown(5172, 0 /* receive */)         = -1 ENOTCONN (Transport
endpoint is not connected)
shutdown(5221, 1 /* send */)            = 0
poll([{fd=5221, events=POLLIN|POLLERR}, {fd=5172, events=0,
revents=POLLHUP}], 2, 60000) = 1
read(5172, "", 8192)                    = 0
shutdown(5172, 0 /* receive */)         = -1 ENOTCONN (Transport
endpoint is not connected)
shutdown(5221, 1 /* send */)            = 0
poll([{fd=5221, events=POLLIN|POLLERR}, {fd=5172, events=0,
revents=POLLHUP}], 2, 60000) = 1

The following check seems to solve this paricular problem:

Index: cache_pipe.c
===================================================================
--- cache_pipe.c        (revision 2042)
+++ cache_pipe.c        (working copy)
@@ -119,6 +119,9 @@
                        rdf(fds, 0);
                if (fds[1].revents)
                        rdf(fds, 1);
+               if (fds[0].revents == POLLHUP || fds[1].revents == POLLHUP)
+                       /* XXX what about POLLERR, POLLNVAL? */
+                       break;
        }
        vca_close_session(sp, "pipe");
        VBE_ClosedFd(sp->wrk, vc);


-- 
Michal Belczyk




More information about the varnish-bugs mailing list