]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: connections: Don't call shutdown() if we want to disable linger.
authorOlivier Houchard <ohouchard@haproxy.com>
Fri, 14 Jun 2019 13:26:06 +0000 (15:26 +0200)
committerOlivier Houchard <cognet@ci0.org>
Fri, 14 Jun 2019 13:33:41 +0000 (15:33 +0200)
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.

include/proto/connection.h

index 115e7aaa3bc9a03b993b23d8363bc51d6a246387..1e5fc9c9e641a28c70fed3896483efd387e5ec8d 100644 (file)
@@ -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);
 }