openldap memory leak

Posted on

It seems that openldap has a persistent problem with memory leaks in RHEL. This has plagued us for several years and has never been fixed.

Symptom:
After starting slapd, memory utilization slowly increases about 1mb every 1-2 seconds. It exceeds the configured cachesize. Eventually the process consumes all available memory on the server, causing swapping, service interruption, and finally, slapd crashes

Configuration:
DB_CONFIG is simple

set_cachesize 8 0 1
set_lg_max 10485760
set_lg_dir /var/lib/ldap
set_flags DB_LOG_AUTOREMOVE

The process has been running for 7 hours. By the end of today, it will have consumed all available memory on the server and will crash
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
9301 ldap 18 0 22.8g 19g 10g S 6.4 42.2 103:48.45 slapd

Workaround:
Restart slapd every 12 hours

Affected versions:
openldap-2.4.23-34.el6_5.1.x86_64
openldap-2.3.43-28.el5_10