From: Olivier Houchard Date: Fri, 14 Jun 2019 13:26:06 +0000 (+0200) Subject: BUG/MEDIUM: connections: Don't call shutdown() if we want to disable linger. X-Git-Tag: v2.0.0~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe4abe6;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: connections: Don't call shutdown() if we want to disable linger. In conn_sock_shutw(), avoid calling shutdown() if linger_risk is set. Not doing so will result in getting sockets in TIME_WAIT for some time. This is particularly observable with health checks. This should be backported to 1.9. --- diff --git a/include/proto/connection.h b/include/proto/connection.h index 115e7aaa3b..1e5fc9c9e6 100644 --- a/include/proto/connection.h +++ b/include/proto/connection.h @@ -352,7 +352,8 @@ static inline void conn_sock_shutw(struct connection *c, int clean) /* don't perform a clean shutdown if we're going to reset or * if the shutr was already received. */ - if (conn_ctrl_ready(c) && !(c->flags & CO_FL_SOCK_RD_SH) && clean) + if (conn_ctrl_ready(c) && !(c->flags & CO_FL_SOCK_RD_SH) && clean && + !fdtab[c->handle.fd].linger_risk) shutdown(c->handle.fd, SHUT_WR); }