Bug 1746830 - Memory leak during search of idview overrides
Summary: Memory leak during search of idview overrides
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: slapi-nis
Version: ---
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Alexander Bokovoy
QA Contact: ipa-qe
URL:
Whiteboard:
Depends On:
Blocks: 1825061 1830894
TreeView+ depends on / blocked
 
Reported: 2019-08-29 10:58 UTC by thierry bordaz
Modified: 2020-11-04 02:50 UTC (History)
5 users (show)

Fixed In Version: slapi-nis-0.56.5
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1830894 (view as bug list)
Environment:
Last Closed: 2020-11-04 02:50:13 UTC
Type: Bug
Target Upstream Version:


Attachments (Terms of Use)

Description thierry bordaz 2019-08-29 10:58:31 UTC
Description of problem:

When searching on compat tree over idviews, if an some attributes needs to be override it will trigger a leak for each overridden attributes.


Version-Release number of selected component (if applicable):
Since Idview override


How reproducible:
I have not reproduce myselve but I guess.
Setting up idview override and search on them


Steps to Reproduce:
1.
2.
3.

Actual results:
Creates a leak

Expected results:
should not leak


Additional info:

Comment 2 thierry bordaz 2019-08-29 11:25:21 UTC
Valgrind output contains some entries like, not that debuginfo was missing for schemacompat-plugin

==6541== 20,928 bytes in 654 blocks are indirectly lost in loss record 2,426 of 2,456                                                                       
==6541==    at 0x4C29E63: malloc (vg_replace_malloc.c:309)
==6541==    by 0x5093F82: slapi_ch_malloc (in /usr/lib64/dirsrv/libslapd.so.0.1.0)
==6541==    by 0x5096F81: csnset_add_csn (in /usr/lib64/dirsrv/libslapd.so.0.1.0)
==6541==    by 0x509746E: csnset_dup (in /usr/lib64/dirsrv/libslapd.so.0.1.0)
==6541==    by 0x511E87D: slapi_value_dup (in /usr/lib64/dirsrv/libslapd.so.0.1.0)
==6541==    by 0x511FD5F: valueset_set_valuearray_byval (in /usr/lib64/dirsrv/libslapd.so.0.1.0)
==6541==    by 0x5121011: valueset_dup (in /usr/lib64/dirsrv/libslapd.so.0.1.0)
==6541==    by 0x508D1B1: slapi_attr_get_valueset (in /usr/lib64/dirsrv/libslapd.so.0.1.0)
==6541==    by 0x1B327D13: idview_process_overrides (in /usr/lib64/dirsrv/plugins/schemacompat-plugin.so)
==6541==    by 0x1B30F0DC: ??? (in /usr/lib64/dirsrv/plugins/schemacompat-plugin.so)
==6541==    by 0x1B323532: ??? (in /usr/lib64/dirsrv/plugins/schemacompat-plugin.so)
==6541==    by 0x1B311E9A: ??? (in /usr/lib64/dirsrv/plugins/schemacompat-plugin.so)
==6541==    by 0x1B32366E: ??? (in /usr/lib64/dirsrv/plugins/schemacompat-plugin.so)
==6541==    by 0x1B311BD5: ??? (in /usr/lib64/dirsrv/plugins/schemacompat-plugin.so)
==6541==    by 0x1B3235AF: ??? (in /usr/lib64/dirsrv/plugins/schemacompat-plugin.so)
==6541==    by 0x1B311290: ??? (in /usr/lib64/dirsrv/plugins/schemacompat-plugin.so)
==6541==    by 0x50E6797: ??? (in /usr/lib64/dirsrv/libslapd.so.0.1.0)
==6541==    by 0x50E6A52: plugin_call_plugins (in /usr/lib64/dirsrv/libslapd.so.0.1.0)
==6541==    by 0x50D98A6: op_shared_search (in /usr/lib64/dirsrv/libslapd.so.0.1.0)
==6541==    by 0x13597D: ??? (in /usr/sbin/ns-slapd)
==6541==    by 0x1236A9: ??? (in /usr/sbin/ns-slapd)
==6541==    by 0x732EBAA: _pt_root (ptthread.c:201)
==6541==    by 0x796EDD4: start_thread (pthread_create.c:307)

The fix is immediate (missing slapi_valueset_free)

Comment 4 thierry bordaz 2019-09-11 13:45:39 UTC
Additional leak backstacks with symbols

==22014== 89,483 bytes in 1,335 blocks are definitely lost in loss record 2,517 of 2,525
==22014==    at 0x4C29E63: malloc (vg_replace_malloc.c:309)
==22014==    by 0x828C0C9: strdup (strdup.c:42)
==22014==    by 0x50942A2: slapi_ch_strdup (in /usr/lib64/dirsrv/libslapd.so.0.1.0)
==22014==    by 0x1B312676: backend_search_cb (back-sch.c:1724)
==22014==    by 0x50E6797: ??? (in /usr/lib64/dirsrv/libslapd.so.0.1.0)
==22014==    by 0x50E6A52: plugin_call_plugins (in /usr/lib64/dirsrv/libslapd.so.0.1.0)
==22014==    by 0x50D98A6: op_shared_search (in /usr/lib64/dirsrv/libslapd.so.0.1.0)
==22014==    by 0x13597D: ??? (in /usr/sbin/ns-slapd)
==22014==    by 0x1236A9: ??? (in /usr/sbin/ns-slapd)
==22014==    by 0x732EBAA: _pt_root (ptthread.c:201)
==22014==    by 0x796EDD4: start_thread (pthread_create.c:307)
==22014==    by 0x82FDEAC: clone (clone.S:111)
==22014== 
==22014== 553 bytes in 7 blocks are definitely lost in loss record 2,184 of 2,525
==22014==    at 0x4C29E63: malloc (vg_replace_malloc.c:309)
==22014==    by 0x828C0C9: strdup (strdup.c:42)
==22014==    by 0x50942A2: slapi_ch_strdup (in /usr/lib64/dirsrv/libslapd.so.0.1.0)
==22014==    by 0x1B310943: backend_locate (back-sch.c:1984)
==22014==    by 0x1B310EC6: backend_bind_cb (back-sch.c:2597)
==22014==    by 0x50E6797: ??? (in /usr/lib64/dirsrv/libslapd.so.0.1.0)
==22014==    by 0x50E6A52: plugin_call_plugins (in /usr/lib64/dirsrv/libslapd.so.0.1.0)
==22014==    by 0x11C433: ??? (in /usr/sbin/ns-slapd)
==22014==    by 0x1234B7: ??? (in /usr/sbin/ns-slapd)
==22014==    by 0x732EBAA: _pt_root (ptthread.c:201)
==22014==    by 0x796EDD4: start_thread (pthread_create.c:307)
==22014==    by 0x82FDEAC: clone (clone.S:111)
==22014== 
==22014== 654,526 (172,608 direct, 481,918 indirect) bytes in 5,394 blocks are definitely lost in loss record 2,524 of 2,525
==22014==    at 0x4C2BF79: calloc (vg_replace_malloc.c:762)
==22014==    by 0x50941E3: slapi_ch_calloc (in /usr/lib64/dirsrv/libslapd.so.0.1.0)
==22014==    by 0x511FC4F: slapi_valueset_new (in /usr/lib64/dirsrv/libslapd.so.0.1.0)
==22014==    by 0x5120FFD: valueset_dup (in /usr/lib64/dirsrv/libslapd.so.0.1.0)
==22014==    by 0x508D1B1: slapi_attr_get_valueset (in /usr/lib64/dirsrv/libslapd.so.0.1.0)
==22014==    by 0x1B329C53: idview_process_overrides (back-sch-idview.c:181)
==22014==    by 0x1B3103DC: backend_search_entry_cb (back-sch.c:1205)
==22014==    by 0x1B324EE2: map_data_foreach_entry (map.c:277)
==22014==    by 0x1B324EE2: map_data_foreach_entry_id (map.c:311)
==22014==    by 0x1B31337A: backend_search_set_cb (back-sch.c:1308)
==22014==    by 0x1B32501E: map_data_foreach_map (map.c:353)
==22014==    by 0x1B3130B5: backend_search_group_cb (back-sch.c:1473)
==22014==    by 0x1B324F5F: map_data_foreach_domain (map.c:323)
==22014==    by 0x1B312770: backend_search_cb (back-sch.c:1762)
==22014==    by 0x50E6797: ??? (in /usr/lib64/dirsrv/libslapd.so.0.1.0)
==22014==    by 0x50E6A52: plugin_call_plugins (in /usr/lib64/dirsrv/libslapd.so.0.1.0)
==22014==    by 0x50D98A6: op_shared_search (in /usr/lib64/dirsrv/libslapd.so.0.1.0)
==22014==    by 0x13597D: ??? (in /usr/sbin/ns-slapd)
==22014==    by 0x1236A9: ??? (in /usr/sbin/ns-slapd)
==22014==    by 0x732EBAA: _pt_root (ptthread.c:201)
==22014==    by 0x796EDD4: start_thread (pthread_create.c:307)
==22014==    by 0x82FDEAC: clone (clone.S:111)

Comment 8 Florence Blanc-Renaud 2020-02-14 15:42:17 UTC
Thank you taking your time and submitting this request for Red Hat Enterprise Linux 7. Unfortunately, this bug cannot be kept even as a stretch goal and was postponed to RHEL8.

Comment 9 thierry bordaz 2020-02-21 16:35:32 UTC
Patch being push upstream (0.56.4) => POST

Comment 15 Varun Mylaraiah 2020-07-13 10:53:02 UTC
VERIFIED by sanity verification of idviews tests-suite

ipa-server-4.8.7-4.module+el8.3.0+7221+eedbd403.x86_64
slapi-nis-0.56.5-2.module+el8.3.0+6580+328a3362.x86_64

Tried to test memory leak issue on the local machine, by creating idviews and adding/overriding idoverride and looking up the compact tree for user. But not able to reproduce.

[root@ci-vm-10-0-106-86 ~]# ldapsearch -LLL -x -b cn=users,cn=legacy-servers,cn=views,cn=compat,dc=testrealm,dc=test -D "cn=Directory Manager" -W uid=testuser
Enter LDAP Password: 
dn: uid=testuser,cn=users,cn=legacy-servers,cn=views,cn=compat,dc=testrealm,dc
 =test
objectClass: posixAccount
objectClass: top
gecos: test user
cn: test user
uidNumber: 772800004
gidNumber: 772800004
loginShell: /bin/sh
homeDirectory: /home/testuser
uid: testuser


idviews tests-suite result:

============================= test session starts ==============================
platform linux -- Python 3.6.8, pytest-3.4.2, py-1.5.3, pluggy-0.6.0 -- /usr/libexec/platform-python
cachedir: ../../../../../home/cloud-user/.pytest_cache
metadata: {'Python': '3.6.8', 'Platform': 'Linux-4.18.0-223.el8.x86_64-x86_64-with-redhat-8.3-Ootpa', 'Packages': {'pytest': '3.4.2', 'py': '1.5.3', 'pluggy': '0.6.0'}, 'Plugins': {'metadata': '1.10.0', 'html': '1.22.1', 'sourceorder': '0.5', 'multihost': '3.0'}}
rootdir: /usr/lib/python3.6/site-packages/ipatests, inifile:
plugins: metadata-1.10.0, html-1.22.1, sourceorder-0.5, multihost-3.0
collecting ... collected 7 items

test_integration/test_idviews.py::TestIDViews::test_useroverride PASSED  [ 14%]
test_integration/test_idviews.py::TestIDViews::test_useroverride_original_uid PASSED [ 28%]
test_integration/test_idviews.py::TestIDViews::test_anchor_username PASSED [ 42%]
test_integration/test_idviews.py::TestIDViews::test_groupoverride PASSED [ 57%]
test_integration/test_idviews.py::TestIDViews::test_groupoverride_system_objects PASSED [ 71%]
test_integration/test_idviews.py::TestIDViews::test_anchor_groupname PASSED [ 85%]
test_integration/test_idviews.py::TestRulesWithServicePrincipals::test_rules_with_service_principals PASSED [100%]

---------------- generated xml file: /home/cloud-user/junit.xml ----------------
----------- generated html file: file:///home/cloud-user/report.html -----------
========================== 7 passed in 933.04 seconds ==========================

Comment 18 errata-xmlrpc 2020-11-04 02:50:13 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 (Moderate: idm:DL1 and idm:client security, 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/RHSA-2020:4670


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