From: Amaury Denoyelle Date: Thu, 13 Nov 2025 16:45:18 +0000 (+0100) Subject: MINOR: check: clarify check-reuse-pool interaction with reuse policy X-Git-Tag: v3.3-dev13~24 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8415254cea9344bb4755092f32831e5b0e51a927;p=thirdparty%2Fhaproxy.git MINOR: check: clarify check-reuse-pool interaction with reuse policy check-reuse-pool can only perform as expected if reuse policy on the backend is set to aggressive or higher. Update the documentation to reflect this and implement a server diag warning. --- diff --git a/doc/configuration.txt b/doc/configuration.txt index 8987d9fec..c169ba9e7 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -17831,6 +17831,8 @@ check-reuse-pool completion. The main objective is to limit the number of connections opening and closure on a specific server. This feature is compatible only with http-check rulesets. It is silently ignored for other check types. + Furthermore, reuse policy should be set to aggressive on the backend as each + check attempt is performed over a dedicated session. For configuration simplicity, this option is silently ignored if any specific check connect option is defined, either on the server line or via a custom diff --git a/include/haproxy/backend.h b/include/haproxy/backend.h index 41ad4de6e..94ca8f8c5 100644 --- a/include/haproxy/backend.h +++ b/include/haproxy/backend.h @@ -46,6 +46,8 @@ int alloc_bind_address(struct sockaddr_storage **ss, struct server *srv, struct proxy *be, struct stream *s); +int be_reuse_mode(const struct proxy *be, const struct server *srv); + int64_t be_calculate_conn_hash(struct server *srv, struct stream *strm, struct session *sess, struct sockaddr_storage *src, diff --git a/src/backend.c b/src/backend.c index c1f0ab213..ae6eac255 100644 --- a/src/backend.c +++ b/src/backend.c @@ -1555,7 +1555,7 @@ kill_random_idle_conn(struct server *srv) /* Returns backend reuse policy depending on . It can be forced to always * mode if is not NULL and uses reverse HTTP. */ -static int be_reuse_mode(struct proxy *be, struct server *srv) +int be_reuse_mode(const struct proxy *be, const struct server *srv) { if (srv && srv->flags & SRV_F_RHTTP) { /* Override reuse-mode if reverse-connect is used. */ diff --git a/src/cfgdiag.c b/src/cfgdiag.c index 80c277ac1..0d4e580d3 100644 --- a/src/cfgdiag.c +++ b/src/cfgdiag.c @@ -65,8 +65,8 @@ static void srv_diag_cookies(int *ret, struct server *srv, struct eb_root *cooki } } -/* Reports a diag if check-reuse-pool is active while backend check ruleset is - * non HTTP. +/* Reports a diag if check-reuse-pool is active but incompatible with the + * backend configuration. */ static void srv_diag_check_reuse(int *ret, struct server *srv, struct proxy *px) { @@ -75,6 +75,10 @@ static void srv_diag_check_reuse(int *ret, struct server *srv, struct proxy *px) diag_warning(ret, "parsing [%s:%d] : 'server %s': check-reuse-pool is ineffective for non http-check rulesets.\n", srv->conf.file, srv->conf.line, srv->id); } + else if (be_reuse_mode(px, srv) < PR_O_REUSE_AGGR) { + diag_warning(ret, "parsing [%s:%d] : 'server %s': check-reuse-pool is ineffective due to http-reuse policy.\n", + srv->conf.file, srv->conf.line, srv->id); + } } }