]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: limits: display the computed maxconn using ha_notice()
authorWilly Tarreau <w@1wt.eu>
Thu, 20 Nov 2025 17:38:09 +0000 (18:38 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 20 Nov 2025 17:38:09 +0000 (18:38 +0100)
The computed maxconn was only displayed in verbose or debug modes. This
is too bad because lots of users just don't know what they're starting
with and can be trapped when an environment changes. Let's use ha_notice()
instead of a conditional fprintf() so that it gets displayed right after
the other startup messages, hoping that users will get used to seeing it
and more easily spot anomalies. See github issue #3191 for more context.

src/limits.c

index b00cb8cc86bcc00936705939d71b36f19ddf371f..6587ee9b7983bd34f3a4ba8238fe686dc85d2217 100644 (file)
@@ -285,8 +285,7 @@ void set_global_maxconn(void)
        if (!global.rlimit_memmax) {
                if (global.maxconn == 0) {
                        global.maxconn = ideal_maxconn;
-                       if (global.mode & (MODE_VERBOSE|MODE_DEBUG))
-                               fprintf(stderr, "Note: setting global.maxconn to %d.\n", global.maxconn);
+                       ha_notice("Automatically setting global.maxconn to %d.\n", global.maxconn);
                }
        }
 #ifdef USE_OPENSSL
@@ -332,10 +331,8 @@ void set_global_maxconn(void)
                        if (check_if_maxsock_permitted(compute_ideal_maxsock(global.maxconn)))
                                break;
                } while (retried++ < 2);
-
-               if (global.mode & (MODE_VERBOSE|MODE_DEBUG))
-                       fprintf(stderr, "Note: setting global.maxconn to %d and global.maxsslconn to %d.\n",
-                               global.maxconn, global.maxsslconn);
+               ha_notice("Automatically setting global.maxconn to %d and global.maxsslconn to %d.\n",
+                         global.maxconn, global.maxsslconn);
        }
        else if (!global.maxsslconn &&
                 (global.ssl_used_frontend || global.ssl_used_backend)) {