RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1273552 - Deadlock between two MODs on the same entry between entry cache and backend lock
Summary: Deadlock between two MODs on the same entry between entry cache and backend lock
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: 389-ds-base
Version: 6.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Noriko Hosoi
QA Contact: Viktor Ashirov
Petr Bokoc
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-10-20 16:51 UTC by Noriko Hosoi
Modified: 2020-09-13 21:18 UTC (History)
6 users (show)

Fixed In Version: 389-ds-base-1.2.11.15-67.el6
Doc Type: Bug Fix
Doc Text:
*389-ds-base* no longer hangs due to modified entry remaining locked During a modify operation, the modified entry is inserted into entry cache and locked until the modified entry is returned. In cases where the entry is removed from the entry cache after it is committed but before the return operation, the modified entry previously remained locked, and any subsequent write operations on the same entry then caused the server to hang. This bug has been fixed by adding a flag so that the entry can be unlocked whether it is present in the entry cache or not, and the server no longer hangs in this situation.
Clone Of:
Environment:
Last Closed: 2016-05-10 19:22:01 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github 389ds 389-ds-base issues 1309 0 None None None 2020-09-13 21:18:20 UTC
Red Hat Product Errata RHBA-2016:0737 0 normal SHIPPED_LIVE 389-ds-base bug fix and enhancement update 2016-05-10 22:29:13 UTC

Description Noriko Hosoi 2015-10-20 16:51:41 UTC
This bug is created as a clone of upstream ticket:
https://fedorahosted.org/389/ticket/47978

The deadlock occurs when two MODS target the same entry.
One MOD locks the entry in the entry cache (find_entry_internal ?) then tries to acquire the backend lock (in txn_begin).
The second MOD acquired the backend lock (txn_begin) and hangs while locking the entry in the entry cache (cache_lock_entry).

The deadlock occurs while doing performance measurement.
To do this performance and skip the IOs bottleneck, I tuned the :
        - nsslapd-threadnumber: 100
        - nsslapd-db-transaction-batch-val: 100
        - nsslapd-backend-opt-level: 7

This tuning helped to reproduce the hang but are not the cause of the hang.

Deadlock:

MOD ("cn=mr000006001,o=People,o=test_bis_create")
Thread 89 (Thread 0x7f84a97fa700 (LWP 13200)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007f84d1118943 in PR_EnterMonitor (mon=0x7f84480064b0) at ../../../nspr/pr/src/pthreads/ptsynch.c:592
#2  0x00007f84c8a2795a in cache_lock_entry () from /usr/lib64/dirsrv/plugins/libback-ldbm.so
#3  0x00007f84c8a6bde0 in ldbm_back_modify () from /usr/lib64/dirsrv/plugins/libback-ldbm.so
#4  0x00007f84d2d1c8e1 in op_shared_modify () from /usr/lib64/dirsrv/libslapd.so.0
#5  0x00007f84d2d1dc1f in do_modify () from /usr/lib64/dirsrv/libslapd.so.0
#6  0x00007f84d31fc3c1 in connection_threadmain ()
#7  0x00007f84d111de3b in _pt_root (arg=0x7f84d46f7b30) at ../../../nspr/pr/src/pthreads/ptthread.c:212
#8  0x00007f84d0abdee5 in start_thread (arg=0x7f84a97fa700) at pthread_create.c:309
#9  0x00007f84d07ecb8d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

MOD ("cn=mr000006001,o=People,o=test_bis_create")
Thread 87 (Thread 0x7f84a87f8700 (LWP 13202)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007f84d1118943 in PR_EnterMonitor (mon=0x7f84d3feb9d0) at ../../../nspr/pr/src/pthreads/ptsynch.c:592
#2  0x00007f84c8a2c3b7 in dblayer_lock_backend () from /usr/lib64/dirsrv/plugins/libback-ldbm.so
#3  0x00007f84c8a311be in dblayer_txn_begin () from /usr/lib64/dirsrv/plugins/libback-ldbm.so
#4  0x00007f84c8a6ca77 in ldbm_back_modify () from /usr/lib64/dirsrv/plugins/libback-ldbm.so
#5  0x00007f84d2d1c8e1 in op_shared_modify () from /usr/lib64/dirsrv/libslapd.so.0
#6  0x00007f84d2d1dc1f in do_modify () from /usr/lib64/dirsrv/libslapd.so.0
#7  0x00007f84d31fc3c1 in connection_threadmain ()
#8  0x00007f84d111de3b in _pt_root (arg=0x7f84d47321b0) at ../../../nspr/pr/src/pthreads/ptthread.c:212
#9  0x00007f84d0abdee5 in start_thread (arg=0x7f84a87f8700) at pthread_create.c:309

To reproduce:

On F20 - 389-DS 1.3.4
32 cores hardware machine: Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz
32 Gb memory

Install 389-DS 1.3.4 (master branch c3389a46c584fa39b2278a295f8b2b6dad726d31)
Create a suffix and trigger MOD update on low number of entries (using ldclt) so that several mods apply to the same entry

Comment 3 thierry bordaz 2016-01-11 10:17:16 UTC
Hi Amita,

I used a IPA CI test (more specifically a KRA test).
I updated the upstream ticket with the details how to run the tests in https://fedorahosted.org/389/ticket/47978#comment:19

thanks
thierry

Comment 4 Amita Sharma 2016-01-12 09:22:33 UTC
(In reply to thierry bordaz from comment #3)
> Hi Amita,
> 
> I used a IPA CI test (more specifically a KRA test).
> I updated the upstream ticket with the details how to run the tests in
> https://fedorahosted.org/389/ticket/47978#comment:19
Thanks Thierry,

I did some investigation and discussed with Kaleem about it.
Above mentioned test is designed for RHEL7 (involved vault), and not for rhel6.

Here is the job which failed, for rhel6 for the test case -
https://beaker.engineering.redhat.com/jobs/1187968

So, can you please mention how it can be tested on rhel6.

Thanks & Regards,
Amita
> 
> thanks
> thierry

Comment 5 thierry bordaz 2016-01-12 10:03:34 UTC
Hi Amita,

The bug is dynamic. DS is using an entry cache and the bug occurs if an entry was in the entry cache during the update but no longer in the entry cache at the end of the update. This is something difficult to acheive.

I think you can try to reproduce with something like:
  - provision 1000 entries
  - stop DS, set nsslapd-cachesize=10, start DS
  - run load of unindexed searches or simple lookup all the entries
  - Then during the load, do an update on an entry (it can be always the same entry).

This test case can be sufficient to reproduce but it is difficult to be sure it will succeeds.


thanks
theirry

Comment 6 Amita Sharma 2016-02-04 10:38:08 UTC
Followed steps in comment#5
[root@vm-idm-001 export]# rpm -qa | grep 389
389-ds-base-1.2.11.15-72.el6.x86_64
389-ds-base-libs-1.2.11.15-72.el6.x86_64

[root@vm-idm-001 export]# i=10; while [ $i > 10 ]; do ldapsearch -x -h localhost -p 389 -D "cn=directory manager" -w Secret123 -b "dc=example,dc=com"; i=`expr $i - 1`; done

[root@vm-idm-001 ~]# ldapmodify -x -h localhost -p 389 -D "cn=directory manager" -w Secret123 << EOF
dn: uid=FBechtel998,ou=Accounting,dc=example,dc=com
changetype: modify
replace: employeeType
employeeType: Super       
EOF
modifying entry "uid=FBechtel998,ou=Accounting,dc=example,dc=com"

[root@vm-idm-001 ~]# ldapmodify -x -h localhost -p 389 -D "cn=directory manager" -w Secret123 << EOF
dn: uid=FBechtel998,ou=Accounting,dc=example,dc=com
changetype: modify
replace: employeeType
employeeType: Supe1r
EOF

modifying entry "uid=FBechtel998,ou=Accounting,dc=example,dc=com"

[root@vm-idm-001 ~]# ldapmodify -x -h localhost -p 389 -D "cn=directory manager" -w Secret123 << EOF
dn: uid=FBechtel998,ou=Accounting,dc=example,dc=com
changetype: modify
replace: employeeType
employeeType: Supe1r1
EOF

modifying entry "uid=FBechtel998,ou=Accounting,dc=example,dc=com"

[root@vm-idm-001 ~]# ldapmodify -x -h localhost -p 389 -D "cn=directory manager" -w Secret123 << EOF
dn: uid=FBechtel998,ou=Accounting,dc=example,dc=com
changetype: modify
replace: employeeType
employeeType: Supe1r11
EOF

modifying entry "uid=FBechtel998,ou=Accounting,dc=example,dc=com"

[root@vm-idm-001 ~]# ldapmodify -x -h localhost -p 389 -D "cn=directory manager" -w Secret123 << EOF
dn: uid=FBechtel998,ou=Accounting,dc=example,dc=com
changetype: modify
replace: employeeType
employeeType: Supe1211
EOF

modifying entry "uid=FBechtel998,ou=Accounting,dc=example,dc=com"

Nothing seems to fail here, marking bug as VERIFIED.

Comment 8 errata-xmlrpc 2016-05-10 19:22:01 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/RHBA-2016-0737.html


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