]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: check: clarify check-reuse-pool interaction with reuse policy
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 13 Nov 2025 16:45:18 +0000 (17:45 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 14 Nov 2025 09:44:05 +0000 (10:44 +0100)
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.

doc/configuration.txt
include/haproxy/backend.h
src/backend.c
src/cfgdiag.c

index 8987d9fec9ea3a72de1fff2f202f7c4dd078ffd4..c169ba9e79de4800cef91e5d3933cf9920509c59 100644 (file)
@@ -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
index 41ad4de6e390eb242465c168dae69a0d01c05498..94ca8f8c5ab475df851f17be5bfe7c89dbdb2bc2 100644 (file)
@@ -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,
index c1f0ab2130f60fa01a38484555ad030fb97ceec5..ae6eac255ae63fa009062d8cb1e940d52e9f14d0 100644 (file)
@@ -1555,7 +1555,7 @@ kill_random_idle_conn(struct server *srv)
 /* Returns backend reuse policy depending on <be>. It can be forced to always
  * mode if <srv> 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. */
index 80c277ac182df384570ff00c1a13913110d92558..0d4e580d3f58dfe65af704d7e27d750f569778ef 100644 (file)
@@ -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);
+               }
        }
 }