Bug 472999 - vlv: memory leak
Summary: vlv: memory leak
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: 389
Classification: Retired
Component: Database - Indexes/Searches
Version: 1.1.3
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Noriko Hosoi
QA Contact: Chandrasekar Kannan
URL:
Whiteboard:
Depends On:
Blocks: 249650 FDS1.2.0
TreeView+ depends on / blocked
 
Reported: 2008-11-25 23:28 UTC by Noriko Hosoi
Modified: 2015-01-04 23:35 UTC (History)
3 users (show)

Fixed In Version: 8.1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-04-29 23:08:13 UTC


Attachments (Terms of Use)
cvs diff ldap/servers/slapd/back-ldbm/vlv.c (896 bytes, patch)
2008-11-25 23:38 UTC, Noriko Hosoi
no flags Details | Diff
cvs commit message (551 bytes, text/plain)
2008-11-26 20:13 UTC, Noriko Hosoi
no flags Details
valgrind output (133.82 KB, application/octet-stream)
2009-04-01 16:09 UTC, Jenny Severance
no flags Details

Description Noriko Hosoi 2008-11-25 23:28:39 UTC
Description of problem:
When vlv search is executed with the option specifying the search value 
 -G before:after:value where 'before'
                'after' are the number of entries surrounding 'value'
                'value' is the search value.
and the value itself does not exist in the vlv index, the closest existing key is retrieved from the database and the key is not released.

[output from valgrind]
==11230== 58 bytes in 1 blocks are definitely lost in loss record 1,534 of 1,690
==11230==    at 0x4A0739E: malloc (vg_replace_malloc.c:207)
==11230==    by 0x4C4E603: slapi_ch_malloc (ch_malloc.c:155)
==11230==    by 0x91AD106: __os_umalloc (os_alloc.c:83)
==11230==    by 0x915E343: __db_retcopy (db_ret.c:123)
==11230==    by 0x915E247: __db_ret (db_ret.c:68)
==11230==    by 0x9136678: __dbc_get (db_cam.c:790)
==11230==    by 0x9146FF3: __dbc_get_pp (db_iface.c:2095)
==11230==    by 0x8E0E7D9: vlv_build_candidate_list_byvalue (vlv.c:959)
==11230==    by 0x8E0EEE8: vlv_build_candidate_list (vlv.c:1180)
==11230==    by 0x8E0EC84: vlv_search_build_candidate_list (vlv.c:1103)
==11230==    by 0x8DFE0E8: ldbm_back_search (ldbm_search.c:390)
==11230==    by 0x4C89170: op_shared_search (opshared.c:547)
==11230==    by 0x429739: do_search (search.c:350)
==11230==    by 0x4127A0: connection_dispatch_operation (connection.c:530)
==11230==    by 0x413D77: connection_threadmain (connection.c:2161)
==11230==    by 0x3C2C429AA2: (within /lib64/libnspr4.so)
==11230==    by 0x3C1D407299: start_thread (pthread_create.c:297)
==11230==    by 0x3C1C8E439C: clone (in /lib64/libc-2.8.so)

[Step to reproduce]
1. create a test ldif file by dbgen.pl
   dbgen.pl -o example5k.ldif -n 5000
2. import the ldif file
3. create a browsing index on Product Develoment
4. run ldapsearch with "value" which does not exist in the vlv index file.
ldapsearch -b "ou=Product Development, dc=example,dc=com" -s onelevel -x -S "cn givenName o ou sn" -G 0:120:abc "(|(objectClass=*)(objectClass=ldapsubentry))" objectClass numSubordinates ref aci

Comment 1 Noriko Hosoi 2008-11-25 23:38:02 UTC
Created attachment 324681 [details]
cvs diff ldap/servers/slapd/back-ldbm/vlv.c

Description: if the addresses of the passed key and the returned key don't match, the space for the returned key is allocated in libdb.  Thus, we have to release the returned key.

Comment 2 Noriko Hosoi 2008-11-26 20:13:12 UTC
Created attachment 324791 [details]
cvs commit message

Reviewed by Nathan (Thank you!!)

Checked in into CVS HEAD.

Comment 3 Jenny Severance 2009-04-01 16:09:13 UTC
followed steps in description for reproducing:

[root@jennyv4 slapd-jennyv4]# /usr/lib/mozldap6/ldapsearch -h `hostname` -p 389 -D "cn=Directory Manager" -w Secret123 -b "ou=Product Development, dc=example,dc=com" -s onelevel -S "cn givenName o ou sn" -G 0:123:abc "(|(objectClass=*)(objectClass=ldapsubentry))" objectClass numSubordinates ref aci
ldap_search: Sort Control is missing
ldap_search: additional info: VLV Control
ldap_parse_virtuallist_control: Requested LDAP control not found

valgrind output is attached.

Believe this to be fixed Noriko can you double check?
Thanks

Comment 4 Jenny Severance 2009-04-01 16:09:38 UTC
Created attachment 337571 [details]
valgrind output

Comment 5 Noriko Hosoi 2009-04-01 16:25:01 UTC
(In reply to comment #3)
> followed steps in description for reproducing:
> 
> [root@jennyv4 slapd-jennyv4]# /usr/lib/mozldap6/ldapsearch -h `hostname` -p 389
> -D "cn=Directory Manager" -w Secret123 -b "ou=Product Development,
> dc=example,dc=com" -s onelevel -S "cn givenName o ou sn" -G 0:123:abc
> "(|(objectClass=*)(objectClass=ldapsubentry))" objectClass numSubordinates ref
> aci
> ldap_search: Sort Control is missing
> ldap_search: additional info: VLV Control
> ldap_parse_virtuallist_control: Requested LDAP control not found

"-x" is missing from the command line.
    -x          performing sorting on server

You are not supposed to see the error to reproduce this bug...

Comment 6 Jenny Severance 2009-04-01 16:50:01 UTC
with -x :

...........
dn: uid=BDigilio1328, ou=Product Development, dc=example,dc=com
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
numSubordinates: 0

dn: uid=BMcTurner5, ou=Product Development, dc=example,dc=com
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
numSubordinates: 0

dn: uid=BPokrywa2783, ou=Product Development, dc=example,dc=com
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
numSubordinates: 0
index 1 content count 959

and - valgrind output contains:

[root@jennyv4 slapd-jennyv4]# cat 472999.out | grep vlv
==14075==    by 0x575FA78: vlvIndex_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B549: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575FA62: vlvIndex_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B549: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575FA3A: vlvIndex_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B549: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575EB6B: vlvSearch_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B48A: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575FA3A: vlvIndex_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B549: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575F9F1: vlvIndex_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B549: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575FA3A: vlvIndex_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B549: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575EB6B: vlvSearch_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B48A: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575EAA8: vlvSearch_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B48A: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575FA0E: vlvIndex_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B549: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575EA5A: vlvSearch_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B48A: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575EA30: vlvSearch_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B48A: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575E9FE: vlvSearch_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B48A: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575E9EC: vlvSearch_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B48A: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575EA28: vlvSearch_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B48A: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575FC60: vlvIndex_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B549: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575FC38: vlvIndex_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B549: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575E9EC: vlvSearch_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B48A: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575F0A4: vlvIndex_new (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B549: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B87F: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575E9EC: vlvSearch_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B48A: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575E9EC: vlvSearch_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B48A: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B87F: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B87F: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B87F: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575E9EC: vlvSearch_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B48A: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575E9EC: vlvSearch_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B48A: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575E9EC: vlvSearch_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B48A: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575E9EC: vlvSearch_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B48A: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575E9EC: vlvSearch_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B48A: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575E9EC: vlvSearch_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B48A: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575E865: vlvSearch_new (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B48A: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575EA13: vlvSearch_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B48A: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B87F: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575E9EC: vlvSearch_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B48A: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575F092: vlvIndex_new (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B549: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575EB6B: vlvSearch_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B48A: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575EB6B: vlvSearch_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B48A: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575EA9D: vlvSearch_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B48A: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575F0C8: vlvIndex_new (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B549: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575E9EC: vlvSearch_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B48A: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575E9FE: vlvSearch_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B48A: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575E9FE: vlvSearch_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575B48A: vlv_init (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575E03C: vlv_find_index_by_filter (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575D260: vlv_filter_candidates (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575D260: vlv_filter_candidates (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575D260: vlv_filter_candidates (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575D260: vlv_filter_candidates (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575D260: vlv_filter_candidates (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575D260: vlv_filter_candidates (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575D260: vlv_filter_candidates (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575D260: vlv_filter_candidates (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575D260: vlv_filter_candidates (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575D260: vlv_filter_candidates (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575D260: vlv_filter_candidates (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575D260: vlv_filter_candidates (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575D260: vlv_filter_candidates (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575D260: vlv_filter_candidates (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575D260: vlv_filter_candidates (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575D260: vlv_filter_candidates (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575D260: vlv_filter_candidates (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575D260: vlv_filter_candidates (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575D260: vlv_filter_candidates (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575D260: vlv_filter_candidates (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575D260: vlv_filter_candidates (in /usr/lib/dirsrv/plugins/libback-ldbm.so)
==14075==    by 0x575D260: vlv_filter_candidates (in /usr/lib/dirsrv/plugins/libback-ldbm.so)

Comment 7 Noriko Hosoi 2009-04-01 17:32:56 UTC
Since your output from grep does not include these functions, I think we could say this particular memory leak was fixed.
==11230==    by 0x8E0E7D9: vlv_build_candidate_list_byvalue (vlv.c:959)
==11230==    by 0x8E0EEE8: vlv_build_candidate_list (vlv.c:1180)

Comment 8 Jenny Severance 2009-04-01 17:40:17 UTC
fix verified - DS 8.1 RHEL 4

Comment 9 Chandrasekar Kannan 2009-04-29 23:08:13 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2009-0455.html


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