[PATCH] Stop accept() timeouts from being counted as sess_fail in varnishstat

Poul-Henning Kamp phk at phk.freebsd.dk
Thu Jan 19 17:05:11 CET 2012


In message <1326987358-26699-1-git-send-email-martin at varnish-software.com>, Mar
tin Blix Grydeland writes:

Commit if tested.

Poul-Henning

>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
>---
> bin/varnishd/cache/cache_acceptor.c |    5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
>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) {
>-- 
>1.7.4.1
>
>
>_______________________________________________
>varnish-dev mailing list
>varnish-dev at varnish-cache.org
>https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
>

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.



More information about the varnish-dev mailing list