Bug 1903221

Summary: Memory leak in 389ds backend (Minor)
Product: Red Hat Enterprise Linux 8 Reporter: Jamie Chapman <jachapma>
Component: 389-ds-baseAssignee: Jamie Chapman <jachapma>
Status: CLOSED ERRATA QA Contact: RHDS QE <ds-qe-bugs>
Severity: low Docs Contact:
Priority: low    
Version: ---CC: aadhikar, bsmejkal, mreynolds, sgouvern, tbordaz, william
Target Milestone: rcKeywords: TestCaseProvided, Triaged
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Linux   
Whiteboard: sync-to-jira
Fixed In Version: 389-ds-base-1.4.3.23-3.module+el8.5.0+11463+c476656c Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-09 18:10:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jamie Chapman 2020-12-01 16:34:35 UTC
Description of problem:
Memory leak detected in backend by ASan memory error detector in https://github.com/389ds/389-ds-base master branch.

How reproducible:
100%

Steps to Reproduce:
1. Clone 389-ds repo 
2. Configure autoconf to use ASan memory error detector 
3. Running any of the below tests trigger the memory leak: 
dirsrvtests/tests/suites/mapping_tree/referral_during_tot_init_test.py
dirsrvtests/tests/suites/import/import_test.py::test_crash_on_ldif2db
dirsrvtests/tests/suites/import/import_test.py::test_issue_a_warning_if_the_cache_size_is_smaller                                                                                                                                                                               
dirsrvtests/tests/suites/import/import_test.py::test_fast_slow_import                                                                                                                    
dirsrvtests/tests/suites/import/import_test.py::test_entry_with_escaped_characters_fails_to_import_and_index                                                                                                                                                    
dirsrvtests/tests/suites/import/import_test.py::test_import_perf_after_failure            
dirsrvtests/tests/suites/import/import_test.py::test_ldif2db_syntax_check


Actual results:
Tests fail, dumping a memory leak trace:
Direct leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x7f72a9e41667 in __interceptor_malloc (/lib64/libasan.so.6+0xb0667)
    #1 0x7f72a9a981c9 in slapi_ch_malloc ldap/servers/slapd/ch_malloc.c:95
    #2 0x7f72a9ab557a in slapi_sdn_new ldap/servers/slapd/dn.c:1903
    #3 0x7f72a9ab5df0 in slapi_sdn_new_normdn_byval ldap/servers/slapd/dn.c:2102
    #4 0x7f72a9ab7bbf in slapi_sdn_dup ldap/servers/slapd/dn.c:2489
    #5 0x7f72a9a90384 in be_addsuffix ldap/servers/slapd/backend.c:176
    #6 0x4426e5 in setup_internal_backends ldap/servers/slapd/fedse.c:2886
    #7 0x446b45 in main ldap/servers/slapd/main.c:720
    #8 0x7f72a9299041 in __libc_start_main (/lib64/libc.so.6+0x27041)

Indirect leak of 11 byte(s) in 1 object(s) allocated from:
    #0 0x7f72a9deb3a7 in strdup (/lib64/libasan.so.6+0x5a3a7)
    #1 0x7f72a9a986b1 in slapi_ch_strdup ldap/servers/slapd/ch_malloc.c:196
    #2 0x7f72a9ab646c in slapi_sdn_set_normdn_byval ldap/servers/slapd/dn.c:2182
    #3 0x7f72a9ab5e07 in slapi_sdn_new_normdn_byval ldap/servers/slapd/dn.c:2103
    #4 0x7f72a9ab7bbf in slapi_sdn_dup ldap/servers/slapd/dn.c:2489
    #5 0x7f72a9a90384 in be_addsuffix ldap/servers/slapd/backend.c:176
    #6 0x4426fe in setup_internal_backends ldap/servers/slapd/fedse.c:2887
    #7 0x446b45 in main ldap/servers/slapd/main.c:720
    #8 0x7f72a9299041 in __libc_start_main (/lib64/libc.so.6+0x27041)

Indirect leak of 1 byte(s) in 1 object(s) allocated from:
    #0 0x7f72a9deb3a7 in strdup (/lib64/libasan.so.6+0x5a3a7)
    #1 0x7f72a9a986b1 in slapi_ch_strdup ldap/servers/slapd/ch_malloc.c:196
    #2 0x7f72a9ab646c in slapi_sdn_set_normdn_byval ldap/servers/slapd/dn.c:2182
    #3 0x7f72a9ab5e07 in slapi_sdn_new_normdn_byval ldap/servers/slapd/dn.c:2103
    #4 0x7f72a9ab7bbf in slapi_sdn_dup ldap/servers/slapd/dn.c:2489
    #5 0x7f72a9a90384 in be_addsuffix ldap/servers/slapd/backend.c:176
    #6 0x4426e5 in setup_internal_backends ldap/servers/slapd/fedse.c:2886
    #7 0x446b45 in main ldap/servers/slapd/main.c:720
    #8 0x7f72a9299041 in __libc_start_main (/lib64/libc.so.6+0x27041)

SUMMARY: AddressSanitizer: 92 byte(s) leaked in 4 allocation(s)

Expected results:
Tests should pass

Additional info:
There may be more tests that trigger this issue.

Comment 7 sgouvern 2021-06-03 12:15:57 UTC
Moving to ITM 18 as discussed in DS multipurpose meeting - not a high priority

Comment 11 thierry bordaz 2021-06-23 08:10:56 UTC
DevMissed because of DTM=16. Bug is fixed in a build => MODIFIED

Comment 12 sgouvern 2021-06-28 14:45:19 UTC
build 389-ds-base-1.4.3.23-3.module+el8.5.0+11463+c476656c.x86_64.rpm planned for ITM 18 needs a respin - Moving to ITM 19

Comment 13 Akshay Adhikari 2021-07-09 10:22:18 UTC
Build Tested: 389-ds-base-1.4.3.23-4.1asan.el8.x86_64

============================================================================ test session starts =================================================================
platform linux -- Python 3.6.8, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- /usr/bin/python3.6
cachedir: .pytest_cache
metadata: {'Python': '3.6.8', 'Platform': 'Linux-4.18.0-319.el8.x86_64-x86_64-with-redhat-8.5-Ootpa', 'Packages': {'pytest': '6.2.4', 'py': '1.10.0', 'pluggy': '0.13.1'}, 'Plugins': {'metadata': '1.11.0', 'html': '3.1.1', 'ignore-flaky': '2.0.0'}}
389-ds-base: 1.4.3.23-4.1asan.el8
nss: 3.67.0-4.el8_4
nspr: 4.31.0-1.el8_4
openldap: 2.4.46-17.el8
cyrus-sasl: not installed
FIPS: disabled
rootdir: /workspace/389-ds-base/dirsrvtests, configfile: pytest.ini
plugins: metadata-1.11.0, html-3.1.1, ignore-flaky-2.0.0
collected 1 item                                                                                                                                                            
 
dirsrvtests/tests/suites/mapping_tree/referral_during_tot_init_test.py::test_referral_during_tot PASSED                                                               [100%]
 
======================================================================= 1 passed in 260.40s (0:04:20) ============================================================


-> Marking as verified: tested

Comment 17 sgouvern 2021-07-09 12:26:52 UTC
As per comment 13, marking as VERIFIED

Comment 19 errata-xmlrpc 2021-11-09 18:10:45 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 (389-ds-base bug fix and enhancement update), 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://access.redhat.com/errata/RHBA-2021:4203