Bug 548115 - memory leak in schema reload
Summary: memory leak in schema reload
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: 389
Classification: Retired
Component: Schema
Version: 1.3.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Noriko Hosoi
QA Contact: Viktor Ashirov
URL:
Whiteboard:
Depends On:
Blocks: 434914 389_1.2.6
TreeView+ depends on / blocked
 
Reported: 2009-12-16 16:59 UTC by Noriko Hosoi
Modified: 2015-12-07 16:32 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-12-07 16:32:38 UTC


Attachments (Terms of Use)
git patch file (3.60 KB, patch)
2010-02-25 02:31 UTC, Noriko Hosoi
nhosoi: review?
rmeggins: review+
Details | Diff
valgrind logs (130.00 KB, application/x-tar)
2010-06-02 20:06 UTC, Jenny Severance
no flags Details

Description Noriko Hosoi 2009-12-16 16:59:58 UTC
Description of problem:
schema reload test in TET run with valgrind reports this leak:
==20763== 1,375,233 (398,792 direct, 976,441 indirect) bytes in 2,463 blocks are definitely lost in loss record 61 of 62
==20763==    at 0x4A05414: calloc (vg_replace_malloc.c:397)
==20763==    by 0x4C5063D: slapi_ch_calloc (ch_malloc.c:243)
==20763==    by 0x4C5FEAA: slapi_entry_alloc (entry.c:1695)
==20763==    by 0x4C5DCF9: str2entry_dupcheck (entry.c:631)
==20763==    by 0x4C5EECB: slapi_str2entry (entry.c:1142)
==20763==    by 0x4C58FB7: dse_read_one_file (dse.c:739)
==20763==    by 0x4C59259: dse_read_file (dse.c:811)
==20763==    by 0x4CB6D61: init_schema_dse_ext (schema.c:4168)
==20763==    by 0x4CB805D: slapi_validate_schema_files (schema.c:4894)
==20763==    by 0xC555F96: schemareload_thread (schema_reload.c:146)
==20763==    by 0x32B7429262: (within /lib64/libnspr4.so)
==20763==    by 0x37A6406869: start_thread (in /lib64/libpthread-2.10.1.so)
==20763==    by 0x37A58DE3BC: clone (in /lib64/libc-2.10.1.so)

Comment 2 Noriko Hosoi 2010-02-23 01:33:48 UTC
DSE initialized in init_schema_dse usually does not get released...

==18156== 9,856 (2,352 direct, 7,504 indirect) bytes in 28 blocks are definitely
 lost in loss record 1,426 of 1,451
==18156==    at 0x4004F1B: calloc (vg_replace_malloc.c:418)
==18156==    by 0x40382D1: slapi_ch_calloc (ch_malloc.c:243)
==18156==    by 0x4047EFD: slapi_entry_alloc (entry.c:1695)
==18156==    by 0x4045FF1: str2entry_dupcheck (entry.c:631)
==18156==    by 0x4046FC8: slapi_str2entry (entry.c:1142)
==18156==    by 0x40413B7: dse_read_one_file (dse.c:739)
==18156==    by 0x4041633: dse_read_file (dse.c:811)
==18156==    by 0x409AEBE: init_schema_dse_ext (schema.c:4168)
==18156==    by 0x409B161: init_schema_dse (schema.c:4232)
==18156==    by 0x805F435: setup_internal_backends (in /usr/sbin/ns-slapd)
==18156==    by 0x80611BD: main (in /usr/sbin/ns-slapd)

Comment 3 Noriko Hosoi 2010-02-25 02:31:04 UTC
Created attachment 396201 [details]
git patch file

Files:
 ldap/servers/slapd/dse.c
 ldap/servers/slapd/schema.c

Description:
dse.c: 1) dse_add_entry_pb is supposed to free the given
the schema entry e.  Although the function never consumes the
entry, it was only freeing it when the entry was added. (If
it was merged or rejected, it was not freed.)

schema.c: 1) when allocating a work buffer with sizedbuffer_allocate,
the space for the NULL termination was not counted.
2) DSE returned from slapi_validate_schema_files must have been
freed regardless of the return value.

Comment 4 Noriko Hosoi 2010-02-25 18:15:10 UTC
Reviewed by Rich (Thank you!!!)

Pushed to master:

$ git merge work
Updating 2cc5ac4..2c28527
Fast forward
 ldap/servers/slapd/dse.c    |   13 ++++++++-----
 ldap/servers/slapd/schema.c |    8 +++++---
 2 files changed, 13 insertions(+), 8 deletions(-)
$ git push
Counting objects: 13, done.
Delta compression using 4 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 1.19 KiB, done.
Total 7 (delta 5), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
   2cc5ac4..2c28527  master -> master

Pushed to Directory_Server_8_2_Branch

$ git push origin ds82-local:Directory_Server_8_2_Branch
Counting objects: 13, done.
Delta compression using 4 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 1.19 KiB, done.
Total 7 (delta 5), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
   0e888ff..9f3536c  ds82-local -> Directory_Server_8_2_Branch

Comment 5 Jenny Severance 2010-06-02 20:06:30 UTC
Created attachment 419148 [details]
valgrind logs

Comment 6 Jenny Severance 2010-06-02 20:07:15 UTC
please review attached valgrind logs for memory leak fix. Thanks!

Comment 7 Rich Megginson 2010-06-02 21:14:33 UTC
None of these are the original leak, so we can declare this as verified.

Comment 8 Jenny Severance 2010-06-03 12:45:54 UTC
verified - RHEL 4

version:
redhat-ds-base-8.2.0-2010060204.el4dsrv

Thank you Rich


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