Monday, April 15, 2019

[389-commits] [389-ds-base] branch 389-ds-base-1.3.9 updated: Ticket 49990 - Increase the default FD limits

This is an automated email from the git hooks/post-receive script.

mreynolds pushed a commit to branch 389-ds-base-1.3.9
in repository 389-ds-base.

The following commit(s) were added to refs/heads/389-ds-base-1.3.9 by this push:
new a6112a4 Ticket 49990 - Increase the default FD limits
a6112a4 is described below

commit a6112a4ba6e8136419901313a22edab211c05120
Author: Mark Reynolds <mreynolds@redhat.com>
AuthorDate: Fri Apr 5 09:16:02 2019 -0400

Ticket 49990 - Increase the default FD limits

Description: As discussed in the ticket, this fix sets the maxdescriptors
to the maximum allowed by the OS/systemd. If this limit can
not be obtained then we fall back to 8192 as the limit

https://pagure.io/389-ds-base/issue/49990

Reviewed by: tbordaz & firstyear(Thanks!!)

(cherry picked from commit 8ca142034a051122b78bdaa3a948d3c50d4cca7e)
(cherry picked from commit 2c583a97cffa54a7da9922215ae37156174a37c5)
---
.../tests/suites/resource_limits/fdlimits_test.py | 63 ++++++++++++++++++++++
ldap/servers/slapd/libglobs.c | 26 +++++----
ldap/servers/slapd/main.c | 5 +-
ldap/servers/slapd/proto-slap.h | 4 +-
ldap/servers/slapd/slap.h | 6 +--
wrappers/systemd.template.service.in | 1 -
wrappers/systemd.template.sysconfig | 3 +-
7 files changed, 90 insertions(+), 18 deletions(-)

diff --git a/dirsrvtests/tests/suites/resource_limits/fdlimits_test.py b/dirsrvtests/tests/suites/resource_limits/fdlimits_test.py
new file mode 100644
index 0000000..e5b14a7
--- /dev/null
+++ b/dirsrvtests/tests/suites/resource_limits/fdlimits_test.py
@@ -0,0 +1,63 @@
+import logging
+import pytest
+import os
+import ldap
+from lib389._constants import *
+from lib389.topologies import topology_st
+
+logging.getLogger(__name__).setLevel(logging.INFO)
+log = logging.getLogger(__name__)
+
+FD_ATTR = "nsslapd-maxdescriptors"
+SYSTEMD_VAL = "16384"
+CUSTOM_VAL = "9000"
+TOO_HIGH_VAL = "65536"
+TOO_LOW_VAL = "0"
+
+
+def test_fd_limits(topology_st):
+ """Test the default limits, and custom limits
+
+ :id: fa0a5106-612f-428f-84c0-9c85c34d0433
+ :setup: Standalone Instance
+ :steps:
+ 1. Check default limit
+ 2. Change default limit
+ 3. Check invalid/too high limit is rejected
+ 4. Check invalid/too low limit is rejected
+ :expectedresults:
+ 1. Success
+ 2. Success
+ 3. Success
+ 4 Success
+ """
+
+ # Check systemd default
+ max_fd = topology_st.standalone.config.get_attr_val_utf8(FD_ATTR)
+ assert max_fd == SYSTEMD_VAL
+
+ # Check custom value is applied
+ topology_st.standalone.config.set(FD_ATTR, CUSTOM_VAL)
+ max_fd = topology_st.standalone.config.get_attr_val_utf8(FD_ATTR)
+ assert max_fd == CUSTOM_VAL
+
+ # Attempt to use val that is too high
+ with pytest.raises(ldap.UNWILLING_TO_PERFORM):
+ topology_st.standalone.config.set(FD_ATTR, TOO_HIGH_VAL)
+ max_fd = topology_st.standalone.config.get_attr_val_utf8(FD_ATTR)
+ assert max_fd == CUSTOM_VAL
+
+ # Attempt to use val that is too low
+ with pytest.raises(ldap.OPERATIONS_ERROR):
+ topology_st.standalone.config.set(FD_ATTR, TOO_LOW_VAL)
+ max_fd = topology_st.standalone.config.get_attr_val_utf8(FD_ATTR)
+ assert max_fd == CUSTOM_VAL
+
+ log.info("Test PASSED")
+
+
+if __name__ == '__main__':
+ # Run isolated
+ # -s for DEBUG mode
+ CURRENT_FILE = os.path.realpath(__file__)
+ pytest.main(["-s", CURRENT_FILE])
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index 59f8d06..91c3a4a 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -131,6 +131,7 @@
#if defined(LINUX)
#include <malloc.h>

No comments:

Post a Comment