From: Amaury Denoyelle Date: Mon, 10 Nov 2025 14:24:35 +0000 (+0100) Subject: BUG/MINOR: do not account backend connections into maxconn X-Git-Tag: v3.3-dev13~49 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7927ee95f3a21455e02f416433280423381d5b22;p=thirdparty%2Fhaproxy.git BUG/MINOR: do not account backend connections into maxconn Remove QUIC backend connections from global actconn accounting. Indeed, this counter is only used on the frontend side. This is required to ensure maxconn coherence. --- diff --git a/src/quic_conn.c b/src/quic_conn.c index 90f3051f7..5ca9a3d1f 100644 --- a/src/quic_conn.c +++ b/src/quic_conn.c @@ -1101,13 +1101,6 @@ struct quic_conn *qc_new_conn(const struct quic_version *qv, int ipv4, TRACE_ENTER(QUIC_EV_CONN_INIT); - next_actconn = increment_actconn(); - if (!next_actconn) { - _HA_ATOMIC_INC(&maxconn_reached); - TRACE_STATE("maxconn reached", QUIC_EV_CONN_INIT); - goto err; - } - next_sslconn = increment_sslconn(); if (!next_sslconn) { TRACE_STATE("sslconn reached", QUIC_EV_CONN_INIT); @@ -1115,6 +1108,13 @@ struct quic_conn *qc_new_conn(const struct quic_version *qv, int ipv4, } if (l) { + next_actconn = increment_actconn(); + if (!next_actconn) { + _HA_ATOMIC_INC(&maxconn_reached); + TRACE_STATE("maxconn reached", QUIC_EV_CONN_INIT); + goto err; + } + next_handshake = quic_increment_curr_handshake(l); if (!next_handshake) { TRACE_STATE("max handshake reached", QUIC_EV_CONN_INIT); @@ -1638,9 +1638,17 @@ int quic_conn_release(struct quic_conn *qc) HA_ATOMIC_DEC(&qc->prx_counters->half_open_conn); } - /* Connection released before handshake completion. */ - if (unlikely(qc->state < QUIC_HS_ST_COMPLETE)) { - if (!qc_is_back(qc)) { + /* Decrement global counters when quic_conn is deallocated. + * quic_conn_closed instances are not accounted as they run for a short + * time with limited resources. + */ + _HA_ATOMIC_DEC(&global.sslconns); + + if (!qc_is_back(qc)) { + _HA_ATOMIC_DEC(&actconn); + + /* Connection released before handshake completion. */ + if (unlikely(qc->state < QUIC_HS_ST_COMPLETE)) { BUG_ON(qc->li->rx.quic_curr_handshake == 0); HA_ATOMIC_DEC(&qc->li->rx.quic_curr_handshake); } @@ -1649,13 +1657,6 @@ int quic_conn_release(struct quic_conn *qc) pool_free(pool_head_quic_conn, qc); qc = NULL; - /* Decrement global counters when quic_conn is deallocated. - * quic_conn_closed instances are not accounted as they run for a short - * time with limited resources. - */ - _HA_ATOMIC_DEC(&actconn); - _HA_ATOMIC_DEC(&global.sslconns); - TRACE_PROTO("QUIC conn. freed", QUIC_EV_CONN_FREED, qc); leave: TRACE_LEAVE(QUIC_EV_CONN_CLOSE, qc);