Bug 1077895 - Memory leak with proxy auth control
Summary: Memory leak with proxy auth control
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: 389-ds-base
Version: 6.4
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Noriko Hosoi
QA Contact: Sankar Ramalingam
Depends On:
TreeView+ depends on / blocked
Reported: 2014-03-18 19:30 UTC by Noriko Hosoi
Modified: 2014-10-14 07:53 UTC (History)
5 users (show)

Fixed In Version: 389-ds-base-
Doc Type: Bug Fix
Doc Text:
Cause: Performing a ldap operation using the proxied authentication control. Consequence: The server can leak memory. Fix: Release the allocated memory once completing the operation. Result: The server does not leak memory when processing operations using the proxied authentication control.
Clone Of:
Last Closed: 2014-10-14 07:53:34 UTC
Target Upstream Version:

Attachments (Terms of Use)
setup LDIF file (1.80 KB, text/x-ldif)
2014-03-25 01:18 UTC, mreynolds
no flags Details
The java source file (2.27 KB, text/x-java)
2014-03-25 01:19 UTC, mreynolds
no flags Details
The java class file(executable) (2.62 KB, application/octet-stream)
2014-03-25 01:20 UTC, mreynolds
no flags Details

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:1385 normal SHIPPED_LIVE 389-ds-base bug fix and enhancement update 2014-10-14 01:27:42 UTC

Description Noriko Hosoi 2014-03-18 19:30:02 UTC
This bug is created as a clone of upstream ticket:

I've been running some load tests against version 389-ds-base- on Centos 6.5. When looking at the vmsize of the ns-slapd process it appears to grow, rather than reaching a plateau. After some modifications to the load test it appears that the memory usage is flat if we remove the portion that performs the proxied authentication control.

I've created a simplified version of the data that exhibits the problem. This backup ldif is attached to the case. It consists of 3 users and 2 acis.

The load is the following pseudocode:
create a simple connection, binding as uid=AUser,o=Test.com
In 30 threads, repeat 1000 times each (i.e. 30000 total searches):
    using this single connection, proxy as uid=PUser,o=Test.com, and search for uid=SUser

In the end, the access log would look something like:
[13/Mar/2014:16:32:57 +0000] conn=5 op=29999 SRCH base="o=test.com" scope=2 filter="(uid=SUser)" attrs=ALL authzid="uid=puser,o=test.com"
[13/Mar/2014:16:32:57 +0000] conn=5 op=29999 RESULT err=0 tag=101 nentries=1 etime=0.001000
[13/Mar/2014:16:32:57 +0000] conn=5 op=30000 SRCH base="o=test.com" scope=2 filter="(uid=SUser)" attrs=ALL authzid="uid=puser,o=test.com"
[13/Mar/2014:16:32:57 +0000] conn=5 op=30000 RESULT err=0 tag=101 nentries=1 etime=0.001000
[13/Mar/2014:16:34:04 +0000] conn=5 op=30002 UNBIND
[13/Mar/2014:16:34:04 +0000] conn=5 op=30002 fd=66 closed - U1

You can see the memory grow with this command:
for((i=0;;++i)) { echo `date` ` grep VmSize /proc/\`pidof ns-slapd\`/status | grep -o '[0-9]*'`; sleep 1 || break; }

Note that when the connection/search finishes, the memory is not freed. If you run the test again it will grow again from the new baseline. The original (more complex and slow) load test caused the ns-slapd process to be aborted due to out-of-memory after around a week.

Comment 1 mreynolds 2014-03-18 20:24:19 UTC
Fixed upstream.

Comment 2 mreynolds 2014-03-25 01:18:32 UTC
Created attachment 878275 [details]
setup LDIF file

Comment 3 mreynolds 2014-03-25 01:19:05 UTC
Created attachment 878276 [details]
The java source file

Comment 4 mreynolds 2014-03-25 01:20:03 UTC
Created attachment 878277 [details]
The java class file(executable)

Comment 5 mreynolds 2014-03-25 01:20:57 UTC
Reproducing this memory leak requires a custom LDAP client.  ldapsearch is not sufficient in this case.  A java script is attached that can reproduce the leak:

The classpath will need to be set to use the latest SUN java version(that contains the "com.sun.jndi.ldap.ctl.ProxiedAuthorizationControl" class) for it to run correctly.

- Setup an instance using the suffix:  o=test.com
- Initialize the database with the attached ldif file(setup.ldif)
- Stop the server, and perform the valgrind setup for the DS.
- Start the server and run the test script
- Stop the server
- grep the output file(found under /var/tmp/slapd.*) for "proxyauth_get_dn".  If this is not found, then the memory leak fix is verified.

Comment 11 errata-xmlrpc 2014-10-14 07:53:34 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.


Note You need to log in before you can comment on or make changes to this bug.