Increase soft limit on slapd open files to 4096

Problem:

After installing/configuring/managing 206 subclouds,
"Can't contact LDAP server" errors were reported when
running sudo commands, and it took a long time to get
to a password prompt when running sudo.

Noted lots of 'Too many open files' logs in local4.log for
the slapd process.

Fix:

We increase the soft limit on the number of open
files for ldap up to the current hard limit of 4096,
from the previous soft limit of 1024.

We do this by running ulimit in the init script for
ldap.  The right way to do this would've been to add
the following systemd config file to the system:
/etc/systemd/system/slapd.service.d/limits.conf
with content:

[Service]
LimitNOFILE=4096

But it doesn't work.  It looks like launching the daemon
from systemd via init scripts interferes with the systemd
ulimit mechanism in some way.

Also openldap source has been checked to see if it can handle
4096 open files, and yes, the FD_SETSIZE is at 4096
already.  Going beyond 4096 will require a change to the
hard limit and source code change to openldap to get a
larger FD_SETSIZE defined.

Change-Id: I0c2da8e7a149a5ea41d8fbde5ecfb3ffac7765e0
Closes-Bug: 1888874
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
This commit is contained in:
Jim Somerville 2020-07-23 15:14:54 -04:00
parent 0a921beabf
commit 29b55438df

View File

@ -35,6 +35,8 @@ RETVAL=0
case "$1" in case "$1" in
start) start)
echo -n "Starting SLAPD: " echo -n "Starting SLAPD: "
# Bump up the open file limit for created daemons
ulimit -n 4096
if [ -f /etc/openldap/schema/cn=config.ldif ]; then if [ -f /etc/openldap/schema/cn=config.ldif ]; then
start-stop-daemon --start --oknodo --quiet --exec $slapd \ start-stop-daemon --start --oknodo --quiet --exec $slapd \
-- -F /etc/openldap/schema/ -- -F /etc/openldap/schema/