From: Willy Tarreau Date: Mon, 20 Apr 2026 12:05:09 +0000 (+0200) Subject: MEDIUM: session: always reset the conn->owner on backend when installing mux X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=d93c53b0dfa7ae256c55d2c6364b8cdde412eadb;p=thirdparty%2Fhaproxy.git MEDIUM: session: always reset the conn->owner on backend when installing mux When installing a mux on the backend, unless we have a good reason for keeping the session set in conn->owner, we must reset it. Having the session there just hides potential bugs and prevents certain tests from being properly done. Now it is much clearer: conn->owner remains set to the session on frontend connections, is set to the session when the connection is private or assimilated private and belongs to the session list, or is NULL. --- diff --git a/src/connection.c b/src/connection.c index f75895a76..f5f5d5ee4 100644 --- a/src/connection.c +++ b/src/connection.c @@ -383,6 +383,17 @@ int conn_install_mux_be(struct connection *conn, void *ctx, struct session *sess if (!mux_ops) return -1; } + + /* unless the connection is private or it's temporarily reserved to the + * session due to a mux presenting a risk of head-of-line blocking and + * the reuse mode is set to "safe", we should reset the owner to avoid + * any ambiguity. + */ + if (!(conn->flags & CO_FL_PRIVATE) && + ((prx->options & PR_O_REUSE_MASK) != PR_O_REUSE_SAFE || + !(mux_ops->flags & MX_FL_HOL_RISK))) + conn->owner = NULL; + return conn_install_mux(conn, mux_ops, ctx, prx, sess); }