Bug 1170708 - COS memory leak when rebuilding the cache
Summary: COS memory leak when rebuilding the cache
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: 389-ds-base
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Noriko Hosoi
QA Contact: Viktor Ashirov
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-12-04 16:23 UTC by mreynolds
Modified: 2015-03-05 09:39 UTC (History)
3 users (show)

Fixed In Version: 389-ds-base-1.3.3.1-10.el7
Doc Type: Bug Fix
Doc Text:
Cause: An internal schema list was not completed freed when the COS cache is released Consequence: A memory leak. Fix: Free the entire schema list from the COS cache. Result: No memory leak
Clone Of:
Environment:
Last Closed: 2015-03-05 09:39:55 UTC
Target Upstream Version:


Attachments (Terms of Use)
valgrind output (80.17 KB, text/plain)
2014-12-24 08:19 UTC, Amita Sharma
no flags Details


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0416 normal SHIPPED_LIVE Important: 389-ds-base security, bug fix, and enhancement update 2015-03-05 14:26:33 UTC

Description mreynolds 2014-12-04 16:23:34 UTC
This bug is created as a clone of upstream ticket:
https://fedorahosted.org/389/ticket/47969

When the COS cache is released, the schema cache is not correctly freed.  We leak memory every time the cache is rebuilt.

{{{
==24017== 102 (72 direct, 30 indirect) bytes in 3 blocks are definitely lost in loss record 1,277 of 2,056
==24017==    at 0x4C2745D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==24017==    by 0x4E854CA: slapi_ch_malloc (ch_malloc.c:155)
==24017==    by 0x111F0244: cos_cache_add_attrval (cos_cache.c:1532)
==24017==    by 0x111F2A48: cos_cache_schema_build (cos_cache.c:2751)
==24017==    by 0x111EE46B: cos_cache_create (cos_cache.c:498)
==24017==    by 0x111EE32E: cos_cache_wait_on_change (cos_cache.c:451)
==24017==    by 0x718FE3A: ??? (in /usr/lib64/libnspr4.so)
==24017==    by 0x77CEEE4: start_thread (in /usr/lib64/libpthread-2.18.so)
==24017==    by 0x7AD8B8C: clone (in /usr/lib64/libc-2.18.so)
}}}

Comment 1 mreynolds 2014-12-04 21:17:23 UTC
Fixed upstream.

Verification steps:

[1]  setup DS using valgrind
[2]  Add 2 COS templates and definitions
[3]  Modify the template in any way
[4]  stop theserver and check the valgrind output file for "cos_cache_add_attrval"
[5]  If it's not found the leak is fixed.

Comment 3 Amita Sharma 2014-12-24 08:19:12 UTC
adding new entry "cn=cosPointer,ou=People,dc=example,dc=com"

adding new entry "cn=cosPointer1,ou=People,dc=example,dc=com"

adding new entry "cn=cosTemplateExample,ou=People,dc=example,dc=com"

adding new entry "cn=cosTemplateExample1,ou=People,dc=example,dc=com"

[root@dhcp201-126 export]# cat /export/COS_poinet.ldif
#cos pointer defination 1
dn: cn=cosPointer,ou=People,dc=example,dc=com
objectClass: top
objectClass: ldapsubentry
objectClass: cossuperdefinition
objectClass: cosPointerDefinition
description: cosPointer example
costemplatedn: cn=cosTemplateExample,ou=people,dc=example,dc=com
cosAttribute: st
cn: cosPointer

#cos pointer defination 2
dn: cn=cosPointer1,ou=People,dc=example,dc=com
objectClass: top
objectClass: ldapsubentry
objectClass: cossuperdefinition
objectClass: cosPointerDefinition
description: cosPointer example
costemplatedn: cn=cosTemplateExample1,ou=people,dc=example,dc=com
cosAttribute: postalCode
cn: cosPointer1

#cos template defination 1
dn: cn=cosTemplateExample,ou=People,dc=example,dc=com
objectClass: top
objectClass: costemplate
objectClass: extensibleobject
st: OR
cn: cosTemplateExample

#cos template defination 2
dn: cn=cosTemplateExample1,ou=People,dc=example,dc=com
objectClass: top
objectClass: costemplate
objectClass: extensibleobject
postalCode: 1234
cn: cosTemplateExample1

[root@dhcp201-126 export]# ldapmodify -D "cn=directory manager" -w Secret123 -p 389 -h localhost << EOF
> dn: cn=cosTemplateExample1,ou=People,dc=example,dc=com
> changetype: modify
> replace: postalCode
> postalCode: 5678
> EOF
modifying entry "cn=cosTemplateExample1,ou=People,dc=example,dc=com"

[root@dhcp201-126 export]# /usr/lib64/dirsrv/slapd-dhcp201-126/stop-slapd 
[root@dhcp201-126 export]# 

#grep cos_cache_add_attrval /tmp/valgrind.out
#

PFA for valgrind.out. Hence VERIFIED.

Comment 4 Amita Sharma 2014-12-24 08:19:51 UTC
Created attachment 972703 [details]
valgrind output

Comment 6 errata-xmlrpc 2015-03-05 09:39:55 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-2015-0416.html


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