]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: connection: Never cleanup server lists when freeing private conns
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 19 Oct 2020 14:49:29 +0000 (16:49 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 19 Oct 2020 15:19:10 +0000 (17:19 +0200)
When a connection is released, depending on its state, it may be detached from
the session and it may be removed from the server lists. The first case may
happen for private or unsharable active connections. The second one should only
be performed for idle or available connections. We never try to remove a
connection from the server list if it is attached to a session. But it is also
important to never try to remove a private connecion from the server lists, even
if it is not attached to a session. Otherwise, the curr_used_conn server counter
is decremented once too often.

This bug was introduced by the commit 04a24c5ea ("MINOR: connection: don't check
priv flag on free"). It is related to the issue #881. It only affects the 2.3,
no backport is needed.

include/haproxy/connection.h

index b735a6e2fd030f6a73dd44f6e77bae3db0b41a5d..9b89d6e420b6b5c236c7ffbba071de9dd9006be2 100644 (file)
@@ -473,7 +473,7 @@ static inline void conn_free(struct connection *conn)
        if (LIST_ADDED(&conn->session_list)) {
                session_unown_conn(conn->owner, conn);
        }
-       else {
+       else if (!(conn->flags & CO_FL_PRIVATE)) {
                if (obj_type(conn->target) == OBJ_TYPE_SERVER)
                        srv_del_conn_from_list(__objt_server(conn->target), conn);
        }