diff --git a/include/common/defaults.h b/include/common/defaults.h index 80ef2c955..fbacca481 100644 --- a/include/common/defaults.h +++ b/include/common/defaults.h @@ -192,11 +192,15 @@ * absolute limit accepted by the system. If the configuration specifies a * higher value, it will be capped to SYSTEM_MAXCONN and a warning will be * emitted. The only way to override this limit will be to set it via the - * command-line '-n' argument. + * command-line '-n' argument. If SYSTEM_MAXCONN is not set, a minimum value + * of 100 will be used for DEFAULT_MAXCONN which almost guarantees that a + * process will correctly start in any situation. */ #ifdef SYSTEM_MAXCONN #undef DEFAULT_MAXCONN #define DEFAULT_MAXCONN SYSTEM_MAXCONN +#elif !defined(DEFAULT_MAXCONN) +#define DEFAULT_MAXCONN 100 #endif /* Minimum check interval for spread health checks. Servers with intervals diff --git a/src/haproxy.c b/src/haproxy.c index 7095d70d9..317acebbb 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -1452,9 +1452,11 @@ static int compute_ideal_maxpipes() /* considers global.maxsocks, global.maxpipes, async engines, SSL frontends and * rlimits and computes an ideal maxconn. It's meant to be called only when * maxsock contains the sum of listening FDs, before it is updated based on - * maxconn and pipes. If there are not enough FDs left, 100 is returned as it - * is expected that it will even run on tight environments. The system will - * emit a warning indicating how many FDs are missing anyway. + * maxconn and pipes. If there are not enough FDs left, DEFAULT_MAXCONN (by + * default 100) is returned as it is expected that it will even run on tight + * environments, and will maintain compatibility with previous packages that + * used to rely on this value as the default one. The system will emit a + * warning indicating how many FDs are missing anyway if needed. */ static int compute_ideal_maxconn() { @@ -1495,7 +1497,7 @@ static int compute_ideal_maxconn() maxconn = remain / (2 + engine_fds); } - return MAX(maxconn, 100); + return MAX(maxconn, DEFAULT_MAXCONN); } /*