Bug 784119

Summary: schema compat is able to consume over 16 gigs of ram and crash the kernel
Product: Red Hat Enterprise Linux 6 Reporter: Rob Crittenden <rcritten>
Component: slapi-nisAssignee: Nalin Dahyabhai <nalin>
Status: CLOSED ERRATA QA Contact: IDM QE LIST <seceng-idm-qe-list>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.2CC: abokovoy, dpal, jgalipea, jr.aquino, nalin, rmeggins
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: slapi-nis-0.37-1.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 771493 Environment:
Last Closed: 2012-06-20 13:36:40 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:
Bug Depends On: 771493    
Bug Blocks:    
Attachments:
Description Flags
sample reproducer none

Description Rob Crittenden 2012-01-23 21:17:49 UTC
+++ This bug was initially created as a clone of Bug #771493 +++

Description of problem:
When processing a great deal of individual changes triggered from the memberof plugin in realtime, schema compat is capable of a sort of storm situation which can consume all available memory to the point of exhaustion.

Version-Release number of selected component (if applicable):
slapi-nis-0.28-1.fc15.x86_64

How reproducible:
100%

Steps to Reproduce:
0. Start with a vanilla FreeIPA Server Install
1. For performance reasons, I find its best to disable schema compat for the import.
2. Import the attached ldif to populate the Directory or run the attached scripted commands to populate the Directory. (This will take 'a long time')
3. Delete the sudorule named admins: ipa sudorule-del admins
4. Run various ldap / freeipa commands: ipa host-find, ldapsearch etc, Notice the huge performance hit.
  
Actual results:
Substantial Memory usage and intense usage of slapd process causes serious performance hit. 

Expected results:
Release previously stored values when computing new schema compat modifications and don't consume all available memory.
Optimized performance during memberof updates.

Additional info:

--- Additional comment from jr.aquino on 2012-01-03 16:45:50 EST ---

Created attachment 550537 [details]
Ldif for complete test directory

--- Additional comment from jr.aquino on 2012-01-03 16:47:21 EST ---

Created attachment 550538 [details]
Scripts to populate Test FreeIPA Directory

As an alternative to importing the previously attached ldif, you should be able to use the included batch scripts to fully populate the test FreeIPA database.

--- Additional comment from nalin on 2012-01-19 14:44:10 EST ---

0.31 and later fix some memory leaks, one of which is quite severe.  Please retest with the candidate update, once it's built, and let me know if the server's memory usage continues to grow without apparent bound -- on my test systems, it's affected (sometimes contrary to my expectations) somewhat by the cache sizes set in the server's cn=config entry.

--- Additional comment from rmeggins on 2012-01-19 15:01:35 EST ---

(In reply to comment #3)
> 0.31 and later fix some memory leaks, one of which is quite severe.  Please
> retest with the candidate update, once it's built, and let me know if the
> server's memory usage continues to grow without apparent bound -- on my test
> systems, it's affected (sometimes contrary to my expectations) somewhat by the
> cache sizes set in the server's cn=config entry.

Yeah - there appears to be a memory leak if the cache is too small to hold all of the entries.  What happens then is that the entries are churned - repeatedly added and deleted - there must be either a memory leak during deletion, or just the accumulated memory fragmentation over time that causes the memory usage to go up.  This may be https://fedorahosted.org/389/ticket/51 - the solution for that is to make sure the nsslapd-cachememsize is large enough to contain all of the data.

--- Additional comment from updates on 2012-01-19 15:02:50 EST ---

slapi-nis-0.34-1.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/slapi-nis-0.34-1.fc15

--- Additional comment from updates on 2012-01-19 15:03:11 EST ---

slapi-nis-0.34-1.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/slapi-nis-0.34-1.fc16

--- Additional comment from updates on 2012-01-21 16:49:29 EST ---

Package slapi-nis-0.34-1.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing slapi-nis-0.34-1.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-0722/slapi-nis-0.34-1.fc16
then log in and leave karma (feedback).

Comment 1 Nalin Dahyabhai 2012-01-31 05:27:27 UTC
Created attachment 558524 [details]
sample reproducer

A script to load test data, based on the original bug report's data set.  When it gets to the "ipa group-add-member" invocation, memory usage will grow noticeably as the plugin visits each of the group's member entries as each member is added to the group, and leaks the contents of those entries.

Comment 3 Jenny Severance 2012-05-25 12:22:28 UTC
verified ::

reproducer script executed on VM with 1GIG memory.  No OOM.

Actual changes took 36101 seconds.
Settled after 211 seconds.

verision ::
ipa-server-2.2.0-15.el6.i686
slapi-nis-0.40-1.el6.i686

Comment 4 errata-xmlrpc 2012-06-20 13:36:40 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.

http://rhn.redhat.com/errata/RHBA-2012-0821.html