mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-03-05 02:49:01 +00:00
BUG/MINOR: init: enforce strict-limits when using master-worker
The strict-limits global option was introduced with commit 0fec3ab7b
("MINOR: init: always fail when setrlimit fails"). When used in
conjuction with master-worker, haproxy will not fail when a setrlimit
fails. This happens because we only exit() if master-worker isn't used.
This patch removes all tests for master-worker mode for all cases covered
by strict-limits scope.
This should be backported from 2.1 onward.
This should fix issue #1042.
Reviewed by William Dauchy <wdauchy@gmail.com>
This commit is contained in:
parent
6ecd59326f
commit
50f757c5fd
@ -3111,8 +3111,7 @@ int main(int argc, char **argv)
|
|||||||
if (global.tune.options & GTUNE_STRICT_LIMITS) {
|
if (global.tune.options & GTUNE_STRICT_LIMITS) {
|
||||||
ha_alert("[%s.main()] Cannot raise FD limit to %d, limit is %d.\n",
|
ha_alert("[%s.main()] Cannot raise FD limit to %d, limit is %d.\n",
|
||||||
argv[0], global.rlimit_nofile, (int)limit.rlim_cur);
|
argv[0], global.rlimit_nofile, (int)limit.rlim_cur);
|
||||||
if (!(global.mode & MODE_MWORKER))
|
exit(1);
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* try to set it to the max possible at least */
|
/* try to set it to the max possible at least */
|
||||||
@ -3135,8 +3134,7 @@ int main(int argc, char **argv)
|
|||||||
if (global.tune.options & GTUNE_STRICT_LIMITS) {
|
if (global.tune.options & GTUNE_STRICT_LIMITS) {
|
||||||
ha_alert("[%s.main()] Cannot fix MEM limit to %d megs.\n",
|
ha_alert("[%s.main()] Cannot fix MEM limit to %d megs.\n",
|
||||||
argv[0], global.rlimit_memmax);
|
argv[0], global.rlimit_memmax);
|
||||||
if (!(global.mode & MODE_MWORKER))
|
exit(1);
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ha_warning("[%s.main()] Cannot fix MEM limit to %d megs.\n",
|
ha_warning("[%s.main()] Cannot fix MEM limit to %d megs.\n",
|
||||||
@ -3147,8 +3145,7 @@ int main(int argc, char **argv)
|
|||||||
if (global.tune.options & GTUNE_STRICT_LIMITS) {
|
if (global.tune.options & GTUNE_STRICT_LIMITS) {
|
||||||
ha_alert("[%s.main()] Cannot fix MEM limit to %d megs.\n",
|
ha_alert("[%s.main()] Cannot fix MEM limit to %d megs.\n",
|
||||||
argv[0], global.rlimit_memmax);
|
argv[0], global.rlimit_memmax);
|
||||||
if (!(global.mode & MODE_MWORKER))
|
exit(1);
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ha_warning("[%s.main()] Cannot fix MEM limit to %d megs.\n",
|
ha_warning("[%s.main()] Cannot fix MEM limit to %d megs.\n",
|
||||||
@ -3320,8 +3317,7 @@ int main(int argc, char **argv)
|
|||||||
"Please raise 'ulimit-n' to %d or more to avoid any trouble.\n",
|
"Please raise 'ulimit-n' to %d or more to avoid any trouble.\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);
|
||||||
if (!(global.mode & MODE_MWORKER))
|
exit(1);
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
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. "
|
||||||
@ -3608,8 +3604,7 @@ int main(int argc, char **argv)
|
|||||||
if (global.tune.options & GTUNE_STRICT_LIMITS) {
|
if (global.tune.options & GTUNE_STRICT_LIMITS) {
|
||||||
ha_alert("[%s.main()] Failed to set the raise the maximum "
|
ha_alert("[%s.main()] Failed to set the raise the maximum "
|
||||||
"file size.\n", argv[0]);
|
"file size.\n", argv[0]);
|
||||||
if (!(global.mode & MODE_MWORKER))
|
exit(1);
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ha_warning("[%s.main()] Failed to set the raise the maximum "
|
ha_warning("[%s.main()] Failed to set the raise the maximum "
|
||||||
@ -3622,8 +3617,7 @@ int main(int argc, char **argv)
|
|||||||
if (global.tune.options & GTUNE_STRICT_LIMITS) {
|
if (global.tune.options & GTUNE_STRICT_LIMITS) {
|
||||||
ha_alert("[%s.main()] Failed to set the raise the core "
|
ha_alert("[%s.main()] Failed to set the raise the core "
|
||||||
"dump size.\n", argv[0]);
|
"dump size.\n", argv[0]);
|
||||||
if (!(global.mode & MODE_MWORKER))
|
exit(1);
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ha_warning("[%s.main()] Failed to set the raise the core "
|
ha_warning("[%s.main()] Failed to set the raise the core "
|
||||||
|
Loading…
Reference in New Issue
Block a user