]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: init: ensure that FD limit is raised to the max allowed
authorWilly Tarreau <w@1wt.eu>
Tue, 21 Jun 2016 09:51:59 +0000 (11:51 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 21 Jun 2016 16:10:50 +0000 (18:10 +0200)
commit164dd0b6e4ad36dc90e9163eeb84d3fb4aa175e9
tree6133621ab53d7dd6ca49b990902284fb1f4ebbf0
parentef6354719b150a22d22e9589f163d47b112f5b20
BUG/MINOR: init: ensure that FD limit is raised to the max allowed

When the requested amount of FDs cannot be allocated, setrlimit() fails.
That's bad because if the limit is set to 1024 and we need 10000, we
stay on 1024 while we could possibly raise it to 4096 thanks to rlim_max.
This patch takes care of trying to assign rlim_cur to rlim_max on failure
so that we get as much as possible if we can't get all we need. The case
is particularly visible when starting haproxy as a non-privileged user
and a large maxconn is specified in the configuration.

Another point of doing this is that it is the only way to allow us to
close inherited FDs upon fork(), ie those between rlim_cur and rlim_max.

This patch may be backported to 1.6 and 1.5.
src/haproxy.c