MINOR: config: make strict limits enabled by default

as agreed a few months ago, enable strict-limits for v2.3
update configuration manual accordingly

Signed-off-by: William Dauchy <w.dauchy@criteo.com>
This commit is contained in:
William Dauchy 2020-03-28 19:29:58 +01:00 committed by Willy Tarreau
parent 848dbdf918
commit a5194607ab
3 changed files with 12 additions and 18 deletions

View File

@ -1581,12 +1581,11 @@ wurfl-cache-size <size>
with USE_WURFL=1. with USE_WURFL=1.
strict-limits strict-limits
Makes process fail at startup when a setrlimit fails. Haproxy is tries to set Makes process fail at startup when a setrlimit fails. Haproxy tries to set the
the best setrlimit according to what has been calculated. If it fails, it best setrlimit according to what has been calculated. If it fails, it will
will emit a warning. Use this option if you want an explicit failure of emit a warning. This option is here to guarantee an explicit failure of
haproxy when those limits fail. This option is disabled by default. If it has haproxy when those limits fail. It is enabled by default. It may still be
been enabled, it may still be forcibly disabled by prefixing it with the "no" forcibly disabled by prefixing it with the "no" keyword.
keyword.
3.2. Performance tuning 3.2. Performance tuning
----------------------- -----------------------

View File

@ -1205,8 +1205,6 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
goto out; goto out;
if (kwm == KWM_NO) if (kwm == KWM_NO)
global.tune.options &= ~GTUNE_STRICT_LIMITS; global.tune.options &= ~GTUNE_STRICT_LIMITS;
else
global.tune.options |= GTUNE_STRICT_LIMITS;
} }
else if (!strcmp(args[0], "localpeer")) { else if (!strcmp(args[0], "localpeer")) {
if (alertif_too_many_args(1, file, linenum, args, &err_code)) if (alertif_too_many_args(1, file, linenum, args, &err_code))

View File

@ -1791,6 +1791,7 @@ static void init(int argc, char **argv)
#ifdef USE_THREAD #ifdef USE_THREAD
global.tune.options |= GTUNE_IDLE_POOL_SHARED; global.tune.options |= GTUNE_IDLE_POOL_SHARED;
#endif #endif
global.tune.options |= GTUNE_STRICT_LIMITS;
pid = getpid(); pid = getpid();
progname = *argv; progname = *argv;
@ -3171,8 +3172,7 @@ int main(int argc, char **argv)
if (setrlimit(RLIMIT_NOFILE, &limit) != -1) if (setrlimit(RLIMIT_NOFILE, &limit) != -1)
getrlimit(RLIMIT_NOFILE, &limit); getrlimit(RLIMIT_NOFILE, &limit);
ha_warning("[%s.main()] Cannot raise FD limit to %d, limit is %d. " ha_warning("[%s.main()] Cannot raise FD limit to %d, limit is %d.\n",
"This will fail in >= v2.3\n",
argv[0], global.rlimit_nofile, (int)limit.rlim_cur); argv[0], global.rlimit_nofile, (int)limit.rlim_cur);
global.rlimit_nofile = limit.rlim_cur; global.rlimit_nofile = limit.rlim_cur;
} }
@ -3191,8 +3191,7 @@ int main(int argc, char **argv)
exit(1); exit(1);
} }
else else
ha_warning("[%s.main()] Cannot fix MEM limit to %d megs." ha_warning("[%s.main()] Cannot fix MEM limit to %d megs.\n",
"This will fail in >= v2.3\n",
argv[0], global.rlimit_memmax); argv[0], global.rlimit_memmax);
} }
#else #else
@ -3204,8 +3203,7 @@ int main(int argc, char **argv)
exit(1); exit(1);
} }
else else
ha_warning("[%s.main()] Cannot fix MEM limit to %d megs." ha_warning("[%s.main()] Cannot fix MEM limit to %d megs.\n",
"This will fail in >= v2.3\n",
argv[0], global.rlimit_memmax); argv[0], global.rlimit_memmax);
} }
#endif #endif
@ -3391,8 +3389,7 @@ int main(int argc, char **argv)
} }
else else
ha_alert("[%s.main()] FD limit (%d) too low for maxconn=%d/maxsock=%d. " ha_alert("[%s.main()] FD limit (%d) too low for maxconn=%d/maxsock=%d. "
"Please raise 'ulimit-n' to %d or more to avoid any trouble." "Please raise 'ulimit-n' to %d or more to avoid any trouble.\n",
"This will fail in >= v2.3\n",
argv[0], (int)limit.rlim_cur, global.maxconn, global.maxsock, argv[0], (int)limit.rlim_cur, global.maxconn, global.maxsock,
global.maxsock); global.maxsock);
} }
@ -3674,7 +3671,7 @@ int main(int argc, char **argv)
} }
else else
ha_warning("[%s.main()] Failed to set the raise the maximum " ha_warning("[%s.main()] Failed to set the raise the maximum "
"file size. This will fail in >= v2.3\n", argv[0]); "file size.\n", argv[0]);
} }
#endif #endif
@ -3688,7 +3685,7 @@ int main(int argc, char **argv)
} }
else else
ha_warning("[%s.main()] Failed to set the raise the core " ha_warning("[%s.main()] Failed to set the raise the core "
"dump size. This will fail in >= v2.3\n", argv[0]); "dump size.\n", argv[0]);
} }
#endif #endif