git-daemon poll() spinning out of control
authorJens Axboe <axboe@suse.de>
Thu, 20 Oct 2005 07:52:32 +0000 (00:52 -0700)
committerJunio C Hamano <junkio@cox.net>
Fri, 21 Oct 2005 04:26:31 +0000 (21:26 -0700)
With the '0' timeout given to poll, it returns instantly without any
events on my system, causing git-daemon to consume all the CPU time. Use
-1 as the timeout so poll() only returns in case of EINTR or actually
events being available.

Signed-off-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
daemon.c
index c3381b344ccbeff2f13a52c83f17b9960798d8c3..b3bcd7a60a9281e16a15d4e8f73bb73c73fd5c7f 100644 (file)
--- a/daemon.c
+++ b/daemon.c
@@ -533,7 +533,7 @@ static int service_loop(int socknum, int *socklist)
        for (;;) {
                int i;
 
-               if (poll(pfd, socknum, 0) < 0) {
+               if (poll(pfd, socknum, -1) < 0) {
                        if (errno != EINTR) {
                                error("poll failed, resuming: %s",
                                      strerror(errno));