diff --git a/include/haproxy/defaults.h b/include/haproxy/defaults.h index f5f3b5459..0dc25818d 100644 --- a/include/haproxy/defaults.h +++ b/include/haproxy/defaults.h @@ -289,6 +289,16 @@ #define DEFAULT_MAXCONN 100 #endif +/* Define a maxconn which will be used in the master process once it re-exec to + * the MODE_MWORKER_WAIT and won't change when SYSTEM_MAXCONN is set. + * + * 100 must be enough for the master since it only does communication between + * the master and the workers, and the master CLI. + */ +#ifndef MASTER_MAXCONN +#define MASTER_MAXCONN 100 +#endif + /* Minimum check interval for spread health checks. Servers with intervals * greater than or equal to this value will have their checks spread apart * and will be considered when searching the minimal interval. diff --git a/src/haproxy.c b/src/haproxy.c index 19463f29e..3def1ed98 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -2380,7 +2380,7 @@ static void init(int argc, char **argv) /* set the default maxconn in the master, but let it be rewritable with -n */ if (global.mode & MODE_MWORKER_WAIT) - global.maxconn = DEFAULT_MAXCONN; + global.maxconn = MASTER_MAXCONN; if (cfg_maxconn > 0) global.maxconn = cfg_maxconn;