Bug 1695014

Summary: Clarify the ability to change the NOFILE limit
Product: Red Hat Enterprise Linux 7 Reporter: Cedric Buissart <cbuissar>
Component: 389-ds-baseAssignee: mreynolds
Status: CLOSED ERRATA QA Contact: RHDS QE <ds-qe-bugs>
Severity: low Docs Contact:
Priority: unspecified    
Version: 7.6CC: aadhikar, lkrispen, nkinder, pasik, rmeggins, spichugi, tbordaz, vashirov
Target Milestone: rc   
Target Release: 7.7   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 389-ds-base-1.3.9.1-5.el7 Doc Type: Bug Fix
Doc Text:
Cause: Trying to change the NOFILE limits (limit of opened file descriptors that the kernel will allow) Consequence: The server unexpectedly uses a different FD limit via a configuration attribute setting. Fix: Document how the server overrides the systemd FD limits. Result: The server complies with the documentation
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-06 12:59:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Cedric Buissart 2019-04-02 09:56:04 UTC
Description of problem:

Trying to change the NOFILE limits (limit of opened file descriptors that the kernel will allow), I opened the dirsrv@.service.
It redirects to /etc/sysconfig/dirsrv.system

```
# if you need to set other directives e.g. LimitNOFILE=8192
# set them in this file
.include /etc/sysconfig/dirsrv.system
```

So I opened the said file and changed the data there, as described :

```
# This controls the number of file handles avaliable. File handles
# correlate to sockets for the process, and our access to logs and
# databases.
#LimitNOFILE=16384
LimitNOFILE=65535
```

And restarted the service.

Upon restart, *only* the hard-limits was modified. Soft limit was still 1024 :

```
# cat /proc/$(cat /var/run/dirsrv/slapd-CEDRIC-COM.pid)/limits  | grep -e Limit -e "open files"
Limit                     Soft Limit           Hard Limit           Units     
Max open files            1024                 65535                files
```

Upon further search, it appears that ns-slapd overrides its NOFILE soft limits to `nsslapd-maxdescriptors` from cn=config, and defaults to 1024.

I would propose the following changes :

1) by default, if nsslapd-maxdescriptors isn't set in dse.ldif, ns-slapd should not override its corresponding soft limit value. (especially in systemd-enabled system, where there is already a configuration for this)

2) The comments in /etc/sysconfig/dirsrv.system should make it clear that there is a nsslapd-maxdescriptors cn=config entry that may/will override the soft limit

Comment 2 Akshay Adhikari 2019-05-27 12:10:14 UTC
Build Tested: 389-ds-base-1.3.9.1-7.el7.x86_64

Steps:

1) In /etc/sysconfig/dirsrv.systemd set LimitNOFILE to some value eg:(21345)

2) Restart the server.

3) Check the Soft limit also is modified to the value which was set (21345)

[root@web9 ~]# cat /proc/$(cat /var/run/dirsrv/slapd-{instance_name}.pid)/limits  | grep -e Limit -e "open files"
Limit                     Soft Limit           Hard Limit           Units     
Max open files            21345                21345                files     

4) Check comments in /etc/sysconfig/dirsrv.systemd which makes it clear that there is a configuration setting in Directory Server: nsslapd-maxdescriptors that can override the soft limit.

# databases.  Note, the configuration setting in Directory Server,
# "nsslapd-maxdescriptors", can override this limit.
#LimitNOFILE=16384


Marking it as VERIFIED.

Comment 4 errata-xmlrpc 2019-08-06 12:59:17 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:2152