Bug 1364190

Summary: Change example in /etc/sysconfig/dirsrv to use tcmalloc
Product: Red Hat Enterprise Linux 7 Reporter: Viktor Ashirov <vashirov>
Component: 389-ds-baseAssignee: Noriko Hosoi <nhosoi>
Status: CLOSED ERRATA QA Contact: Viktor Ashirov <vashirov>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: lmiksik, mreynolds, nkinder, rmeggins
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 389-ds-base-1.3.5.10-9.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-03 20:44:46 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 Viktor Ashirov 2016-08-04 16:31:12 UTC
tail -n 5 /etc/sysconfig/dirsrv
# jemalloc is a general purpose malloc implementation that emphasizes
# fragmentation avoidance and scalable concurrency support.  jemalloc
# has been shown to have a significant positive impact on the Directory
# Server's process size/growth.
#LD_PRELOAD=/usr/lib64/dirsrv/libjemalloc.so.1 ; export LD_PRELOAD

This should be changed to tcmalloc.
Change is required by https://bugzilla.redhat.com/show_bug.cgi?id=1301224

Comment 1 Noriko Hosoi 2016-08-05 00:56:14 UTC
Upstream ticket:
https://fedorahosted.org/389/ticket/48950

Comment 2 mreynolds 2016-08-11 15:45:48 UTC
Fixed upstream

Comment 4 Viktor Ashirov 2016-08-22 17:27:17 UTC
Aug 22 19:16:00 rhel7ds.brq.redhat.com ns-slapd[2675]: ERROR: ld.so: object ';' from LD_PRELOAD cannot be preloaded: ignored.
Aug 22 19:16:00 rhel7ds.brq.redhat.com ns-slapd[2675]: ERROR: ld.so: object 'export' from LD_PRELOAD cannot be preloaded: ignored.
Aug 22 19:16:00 rhel7ds.brq.redhat.com ns-slapd[2675]: ERROR: ld.so: object 'LD_PRELOAD' from LD_PRELOAD cannot be preloaded: ignored.

Line in /etc/sysconfig/dirsrv should be changed to:
LD_PRELOAD=/usr/lib64/libtcmalloc.so.4

After this change there are no errors in journalctl and:
[root@rhel7ds ~]# pldd  $(pidof ns-slapd) | grep tcmalloc
/usr/lib64/libtcmalloc.so

Marking as ASSIGNED.

Comment 5 Noriko Hosoi 2016-08-22 17:51:30 UTC
Hi Viktor,

I'm a bit confused.  This is our suggestion to enable tcmalloc, which looks identical to the line you put in your comment #c4.  What else we could do?

diff --git a/ldap/admin/src/base-initconfig.in b/ldap/admin/src/base-initconfig.in
index e803a36..0481c3e 100644
--- a/ldap/admin/src/base-initconfig.in
+++ b/ldap/admin/src/base-initconfig.in
@@ -43,8 +43,8 @@
 # if using systemd, omit the "; export VARNAME" at the end
 #PID_TIME=600 ; export PID_TIME
 
-# jemalloc is a general purpose malloc implementation that emphasizes
-# fragmentation avoidance and scalable concurrency support.  jemalloc
-# has been shown to have a significant positive impact on the Directory
-# Server's process size/growth.
-#LD_PRELOAD=@libdir@/@package_name@/libjemalloc.so.1 ; export LD_PRELOAD
+# The tcmalloc memory allocator has been shown to have a positive impact on
+# the Directory Server's virtual & resident memory size/growth.  tcmalloc is
+# available on RHEL/Fedora in the gperftools package (this could be different
+# on other platforms).  Here is an example of preloading tcmalloc:
+#LD_PRELOAD=@libdir@/libtcmalloc.so.4 ; export LD_PRELOAD

Comment 6 Viktor Ashirov 2016-08-22 18:15:56 UTC
LD_PRELOAD=/usr/lib64/libtcmalloc.so.4 ; export LD_PRELOAD
                                       ^^^^^^^^^^^^^^^^^^^
This part confuses systemd. Error are logged in journalctl on dirsrv startup:

Aug 22 20:13:51 rhel7ds.brq.redhat.com ds_systemd_ask_password_acl[4891]: ERROR: ld.so: object ';' from LD_PRELOAD cannot be preloaded: ignored.
Aug 22 20:13:51 rhel7ds.brq.redhat.com ds_systemd_ask_password_acl[4891]: ERROR: ld.so: object 'export' from LD_PRELOAD cannot be preloaded: ignored.
Aug 22 20:13:51 rhel7ds.brq.redhat.com ds_systemd_ask_password_acl[4891]: ERROR: ld.so: object 'LD_PRELOAD' from LD_PRELOAD cannot be preloaded: ignored.
Aug 22 20:13:51 rhel7ds.brq.redhat.com ds_systemd_ask_password_acl[4891]: ERROR: ld.so: object ';' from LD_PRELOAD cannot be preloaded: ignored.
Aug 22 20:13:51 rhel7ds.brq.redhat.com ds_systemd_ask_password_acl[4891]: ERROR: ld.so: object 'export' from LD_PRELOAD cannot be preloaded: ignored.
Aug 22 20:13:51 rhel7ds.brq.redhat.com ds_systemd_ask_password_acl[4891]: ERROR: ld.so: object 'LD_PRELOAD' from LD_PRELOAD cannot be preloaded: ignored.
Aug 22 20:13:51 rhel7ds.brq.redhat.com ds_systemd_ask_password_acl[4891]: ERROR: ld.so: object ';' from LD_PRELOAD cannot be preloaded: ignored.
Aug 22 20:13:51 rhel7ds.brq.redhat.com ds_systemd_ask_password_acl[4891]: ERROR: ld.so: object 'export' from LD_PRELOAD cannot be preloaded: ignored.
Aug 22 20:13:51 rhel7ds.brq.redhat.com ds_systemd_ask_password_acl[4891]: ERROR: ld.so: object 'LD_PRELOAD' from LD_PRELOAD cannot be preloaded: ignored.
Aug 22 20:13:51 rhel7ds.brq.redhat.com ds_systemd_ask_password_acl[4891]: ERROR: ld.so: object ';' from LD_PRELOAD cannot be preloaded: ignored.
Aug 22 20:13:51 rhel7ds.brq.redhat.com ds_systemd_ask_password_acl[4891]: ERROR: ld.so: object 'export' from LD_PRELOAD cannot be preloaded: ignored.
Aug 22 20:13:51 rhel7ds.brq.redhat.com ds_systemd_ask_password_acl[4891]: ERROR: ld.so: object 'LD_PRELOAD' from LD_PRELOAD cannot be preloaded: ignored.
Aug 22 20:13:51 rhel7ds.brq.redhat.com ns-slapd[4897]: ERROR: ld.so: object ';' from LD_PRELOAD cannot be preloaded: ignored.
Aug 22 20:13:51 rhel7ds.brq.redhat.com ns-slapd[4897]: ERROR: ld.so: object 'export' from LD_PRELOAD cannot be preloaded: ignored.
Aug 22 20:13:51 rhel7ds.brq.redhat.com ns-slapd[4897]: ERROR: ld.so: object 'LD_PRELOAD' from LD_PRELOAD cannot be preloaded: ignored.

Comment 7 Noriko Hosoi 2016-08-22 18:31:25 UTC
(In reply to Viktor Ashirov from comment #6)
> LD_PRELOAD=/usr/lib64/libtcmalloc.so.4 ; export LD_PRELOAD
>                                        ^^^^^^^^^^^^^^^^^^^
Oh my...  Sorry, I should have looked at the error logs more closely...  I've reopened the upstream ticket, as well...

Comment 8 Rich Megginson 2016-08-22 20:32:40 UTC
In a systemd environment file, you must use 

LD_PRELOAD=/usr/lib64/libtcmalloc.so.4

You cannot use the old sysvinit/bash style:

LD_PRELOAD=/usr/lib64/libtcmalloc.so.4 ; export LD_PRELOAD

Comment 9 Viktor Ashirov 2016-09-05 15:51:34 UTC
Build tested: 389-ds-base-1.3.5.10-10.el7.x86_64

Text was changed to:
# The tcmalloc memory allocator has been shown to have a positive impact on
# the Directory Server's virtual & resident memory size/growth.  tcmalloc is
# available on RHEL/Fedora in the gperftools-libs package (this could be
# different on other platforms).
# If using systemd, omit the "; export LD_PRELOAD" at the end.
LD_PRELOAD=/usr/lib64/libtcmalloc.so.4 ; export LD_PRELOAD

Marking as VERIFIED.

Comment 11 errata-xmlrpc 2016-11-03 20:44:46 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://rhn.redhat.com/errata/RHSA-2016-2594.html