Bug 1443682

Summary: util_info_sys_pages should be able to detect memory restrictions in a cgroup
Product: Red Hat Enterprise Linux 7 Reporter: mreynolds
Component: 389-ds-baseAssignee: mreynolds
Status: CLOSED ERRATA QA Contact: Viktor Ashirov <vashirov>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: nkinder, rmeggins, spichugi
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 389-ds-base-1.3.6.1-14.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 21:16:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description mreynolds 2017-04-19 17:44:03 UTC
This bug is created as a clone of upstream ticket:
https://pagure.io/389-ds-base/issue/48864

In a container, or in systemd it's possible to have memory limits imposed by cgroups. Sadly, these are *not* exposed via getrlimit, or in meminfo. Apparently they have their own api and locations.

For more see:

https://fabiokung.com/2014/03/13/memory-inside-linux-containers/
https://www.freedesktop.org/software/systemd/man/systemd.resource-control.html

It's likely Directory Server will be run in one of these conditions. We should make sure that util_info_sys_pages can detect this correctly so we can make a correct assesment of cache checking.

Comment 3 Simon Pichugin 2017-06-08 15:08:35 UTC
Cmocka unit tests check basic meminfo functionality, but it isn't accessible in the downstream for now.
Mainly we test it with basic sanity testing to see if new memory detection doesn't break the existing functionality.

Build tested:
389-ds-base-1.3.6.1-16.el7.x86_64

[root@qeos-205 389-ds-base-1.3.6.1]# ./test_slapd
[==========] Running 11 test(s).
[ RUN      ] test_libslapd_hello
[       OK ] test_libslapd_hello
[ RUN      ] test_libslapd_pblock_analytics
[       OK ] test_libslapd_pblock_analytics
[ RUN      ] test_libslapd_pblock_v3c_target_dn
[       OK ] test_libslapd_pblock_v3c_target_dn
[ RUN      ] test_libslapd_pblock_v3c_target_sdn
[       OK ] test_libslapd_pblock_v3c_target_sdn
[ RUN      ] test_libslapd_pblock_v3c_original_target_dn
[       OK ] test_libslapd_pblock_v3c_original_target_dn
[ RUN      ] test_libslapd_pblock_v3c_target_uniqueid
[       OK ] test_libslapd_pblock_v3c_target_uniqueid
[ RUN      ] test_libslapd_operation_v3c_target_spec
[       OK ] test_libslapd_operation_v3c_target_spec
[ RUN      ] test_libslapd_counters_atomic_usage
[       OK ] test_libslapd_counters_atomic_usage
[ RUN      ] test_libslapd_counters_atomic_overflow
[       OK ] test_libslapd_counters_atomic_overflow
[ RUN      ] test_libslapd_pal_meminfo
[       OK ] test_libslapd_pal_meminfo
[ RUN      ] test_libslapd_util_cachesane
[       OK ] test_libslapd_util_cachesane
[==========] 11 test(s) run.
[  PASSED  ] 11 test(s).

Marking as verified.

Comment 4 errata-xmlrpc 2017-08-01 21:16:38 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-2017:2086