On Mon, Apr 20, 2026 at 04:07:41AM +0000, Daniel Lenar wrote: > Hello, > Currently, check-reuse-pool only reuses http connections if the connection > pool has been pre-populated by regular traffic. If the http checks need to > create a new connection, then that connection gets marked as private and is > never eligible for connection reuse. However, if it grabs a connection from a > pool that was created via regular traffic, then that connection is re-usable. > This patch is to always have http checks reuse connections regardless of > regular traffic patterns. >
Thanks for your patch. This seems fine to me. I just edited slightly and completed the commit message to better describe the benefit of this change. I attached the newest patch, please tell me if this is ok for you before I can merge it. Thanks, -- Amaury Denoyelle
>From 42e2dbe14eb4a4fc65d4737c21c2ba72749bcea4 Mon Sep 17 00:00:00 2001 From: Daniel Lenar <[email protected]> Date: Fri, 17 Apr 2026 21:29:45 -0500 Subject: [PATCH] MINOR: tcpcheck: Allow connection reuse without prior traffic New connections created by tcpcheck for are marked as private, making them ineligible for insertion into the server-side connection pool, even when check-reuse-pool is activated. Thus, connection reuse for health checks would only work when the pool had already been populated by regular (non-check) traffic. Change this behavior so that a new check connection is not flagged as private anymore when check-reuse-pool is requested. As a result, on detach, instead of being freed, the connection will be inserted in the idle pool and will be eligible for reuse, both for regular traffic and checks. This change can be useful to ensure that a server idle pool is never completely empty when check-reuse-pool is active. Additionnally, it is also necessary to ensure that check reuse is really effective when connection parameters are different between checks and regular traffic, resulting in a different reuse hash. --- src/tcpcheck.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/tcpcheck.c b/src/tcpcheck.c index 657fef757..8e1da3a1d 100644 --- a/src/tcpcheck.c +++ b/src/tcpcheck.c @@ -1284,6 +1284,7 @@ enum tcpcheck_eval_ret tcpcheck_eval_connect(struct check *check, struct tcpchec struct buffer *auto_sni = NULL; int status, port; int check_type; + int64_t hash; #ifdef USE_OPENSSL struct ist sni = IST_NULL; #endif @@ -1334,7 +1335,6 @@ enum tcpcheck_eval_ret tcpcheck_eval_connect(struct check *check, struct tcpchec !srv_is_transparent(s)) { struct ist pool_conn_name = IST_NULL; struct sockaddr_storage *dst, dst_tmp; - int64_t hash; int conn_err; TRACE_DEVEL("trying connection reuse for check", CHK_EV_TCPCHK_CONN, check); @@ -1516,7 +1516,14 @@ enum tcpcheck_eval_ret tcpcheck_eval_connect(struct check *check, struct tcpchec if (status != SF_ERR_NONE) goto fail_check; - conn_set_private(conn); + if (check_type == TCPCHK_RULES_HTTP_CHK && check->reuse_pool && + !tcpcheck_use_nondefault_connect(check, connect) && + !srv_is_transparent(s)) { + conn->hash_node.key = hash; + } else { + conn_set_private(conn); + } + conn->ctx = check->sc; #ifdef USE_OPENSSL -- 2.53.0

