[experimental-ims] b499af9 Stop accept() timeouts from being counted as sess_fail in varnishstat

Geoff Simmons geoff at varnish-cache.org
Tue Jan 24 18:30:27 CET 2012


commit b499af9caad1a1bb1db5ed29c547573cc81fcd66
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Thu Jan 19 16:04:12 2012 +0100

    Stop accept() timeouts from being counted as sess_fail in varnishstat
    
    Varnish sets SO_RCVTIMEO to cache_param->timeout_idle on the listen
    sockets, so that the value is inherited to the accept()ed
    connections. This has the side effect of making accept() returning
    with EAGAIN after cache_param->timeout_idle seconds when there are no
    connections coming in, and each of these timeouts is counted as a
    sess_failed. Also the pacing sleep time is increased for each of these
    timeouts, causing Varnish to react slowly at first when connections
    start coming in.
    
    Patch changes to loop around the call to accept() while EAGAIN

diff --git a/bin/varnishd/cache/cache_acceptor.c b/bin/varnishd/cache/cache_acceptor.c
index d55545b..7918a6a 100644
--- a/bin/varnishd/cache/cache_acceptor.c
+++ b/bin/varnishd/cache/cache_acceptor.c
@@ -186,7 +186,10 @@ VCA_Accept(struct listen_sock *ls, struct wrk_accept *wa)
 		(void)usleep(100*1000);
 
 	wa->acceptaddrlen = sizeof wa->acceptaddr;
-	i = accept(ls->sock, (void*)&wa->acceptaddr, &wa->acceptaddrlen);
+	do {
+		i = accept(ls->sock, (void*)&wa->acceptaddr,
+			   &wa->acceptaddrlen);
+	} while (i < 0 && errno == EAGAIN);
 
 	if (i < 0) {
 		switch (errno) {



More information about the varnish-commit mailing list