You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Regression test in betxn_test.py failing due to busy LDAP server #6595
Issue Description
The regression test dirsrvtests/tests/suites/betxns/betxn_test.py::test_betxn_modrdn_memberof_cache_corruption is failing with the following error:
E ldap.BUSY: {'msgtype': 109, 'msgid': 12, 'result': 51, 'desc': 'Server is busy', 'ctrls': [], 'info': 'target entry busy because of a canceled operation'}
/usr/local/lib64/python3.9/site-packages/ldap/ldapobject.py:128: BUSY
This looks to be due to the server still processing the first group.rename() call, which is meant to fail with an ldap.OBJECT_CLASS_VIOLATION exception, as the second group.rename() call is sent in.
I mitigated this on the test environment with a time.sleep(2), but there should be a better way to fix this. Will keep looking.
Package Version and Platform:
Platform: RHEL 9
Package and version: Multiple builds, but I found it on 389-ds-base-2.4.5-12.el9_4
Steps to Reproduce
Steps to reproduce the behavior:
Run the regression test on a RHEL9 test VM. The test is failing on the main branch currently.
The test will fail.
Expected results
The test passes, assuming the build used doesn't cause the test to fail in other ways.
Additional context
I haven't seen this issue documented elsewhere, so I'm opening it here for reference while I investigate further.
It seems to me that the best way to resolve this is to force a wait until the standalone topology is "free", so to speak. Python is synchronous by default, so I don't think splitting the function into threads would solve the root cause: the first group.rename() call is finished by the time the second one is called, but the server isn't ready.
Hopefully there's a lib389 function or method to ensure the standalone topology isn't busy. Otherwise, I'll probably have to go with the time.sleep() solution. The main solutions I see in dirsrvtests for issues involving time are to sleep, wait, or start threads.
FYI:
The server seldom returns LDAP_BUSY:
It happens when there are too many retries (txn lock conflict) or a conflict in the entry cache after an aborted transaction
As the scenario stress testys the aborted transaction case, sometime getting LDAP_BUSY looks normal.
The usual way to handle LDAP_BUSY (if it is not a bug on the server side) is to wait a bit then retry the operation in a loop: i,e:
retry_if_busy(lambda : managed_entry_user_conn.rename("cn=modrdn group"))
def retry_if_busy(f):
while True:
try:
return f()
except ldap.LDAP_BUSY:
time.sleep(0.02)
I see, thanks for the advice. In all my runs, this test has returned LDAP_BUSY on the 1minutetip machines without intervention i.e. sleep(2), but this method seems more flexible and better suited to solve the actual issue.
Curiously, this solution causes the entire standalone topology to go down on RHEL 9 machines. Barring a significant misconfiguration on my part, I think this has to do with an interaction involving the group.rename() exception being caught in the try except block, and then rerunning group.rename() after the exception is caught. This can be in the while loop, or simply having another rename() call after the except block. Sleeping for longer doesn't seem to make a difference (I tried up to 120 seconds).
The exact same code block causes the test to succeed on RHEL 8 machines; I checked for differences in the group.rename() definition between branches, but I haven't found anything yet. It may be some difference in RHEL itself, or a consequence of larger differences between 389-ds-base branches.
this solution causes the entire standalone topology to go down
Can you precise ?
Is ns-slapd crashing (i.e generating a core) ?
in this case coredumpctl debug should help to see the crashing stack
Or is is doing a shutdown ? In this cased there should be some messages in the error log
Can you precise ? Is ns-slapd crashing (i.e generating a core) ? in this case coredumpctl debug should help to see the crashing stack Or is is doing a shutdown ? In this cased there should be some messages in the error log
There looks to be a coredump caused by ns-slapd. First, py.test returns the error ldap.SERVER_DOWN: {'result': -1, 'desc': "Can't contact LDAP server", 'errno': 104, 'ctrls': [], 'info': 'target entry busy because of a canceled operation'}.
There is also an error log from the topology used in the test: ------------------ Extract of instance standalone1 error log ------------------- [18/Feb/2025:09:11:57.565847243 -0500] - ERR - oc_check_allowed_sv - Entry "uid=testuser,ou=People,dc=example,dc=com" -- attribute "memberOf" not allowed [18/Feb/2025:09:11:57.569440480 -0500] - ERR - oc_check_allowed_sv - Entry "uid=testuser,ou=People,dc=example,dc=com" -- attribute "memberOf" not allowed [18/Feb/2025:09:11:57.570851725 -0500] - ERR - memberof-plugin - memberof_postop_modrdn - Update failed for (cn=group,ou=Groups,dc=example,dc=com), error (65)
Finally, coredumpctl debug shows a generated core: Core was generated by `/usr/sbin/ns-slapd -D /etc/dirsrv/slapd-standalone1 -i /run/dirsrv/slapd-standa'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x00007f74fdb97e48 in backentry_get_ndn (e=e@entry=0x0) at ldap/servers/slapd/back-ldbm/backentry.c:99 99 return (char *)slapi_sdn_get_ndn(slapi_entry_get_sdn_const(e->ep_entry)); [Current thread is 1 (Thread 0x7f70ea9ef640 (LWP 16170))]
The test run also returned a full stack trace I can share if necessary.
Backtracing in coredumpctl debug leads me to backentry_get_ndn (e=e@entry=0x0) at ldap/servers/slapd/back-ldbm/backentry.c:99. Might be relevant, will continue investigating.
Interesting!
FYI:
I do not reproduce the issue on Fedora with main but I reproduce it on latyest RHEL 9 build :
RHEL-9.6.0-20250210.2: with 389-ds-base-2.6.1-2.el9
#0 0x00007fe95eeb9e48 in backentry_get_ndn () at /usr/lib64/dirsrv/plugins/libback-ldbm.so
#1 0x00007fe95eec4707 in id2entry_add_ext () at /usr/lib64/dirsrv/plugins/libback-ldbm.so
#2 0x00007fe95eeeb20e in modify_update_all () at /usr/lib64/dirsrv/plugins/libback-ldbm.so
#3 0x00007fe95eeee762 in ldbm_back_modrdn () at /usr/lib64/dirsrv/plugins/libback-ldbm.so
#4 0x00007fe96398221a in op_shared_rename.constprop () at /usr/lib64/dirsrv/libslapd.so.0
#5 0x00007fe963928b0c in do_modrdn () at /usr/lib64/dirsrv/libslapd.so.0
#6 0x0000559bfcb3ec3c in connection_threadmain ()
#7 0x00007fe963f34c34 in _pt_root () at /lib64/libnspr4.so
#8 0x00007fe96348a3b2 in start_thread () at /lib64/libc.so.6
#9 0x00007fe96350f430 in clone3 () at /lib64/libc.so.6
Neither of my subscriptions is allowed to view the content.
Not a problem generally - can't contribute much anyways.
BUT: Please fix this bug - whatever the reason for it may be :-) Please share a solution/workaround (perferably with explanation) as soon as possible.
We migrated from rock solid 1.3.10 CentOS7 to RHEL9 and every >1.4 version crashes and/or soft-locks in the memberOf plugin.
We couldn't manage to get any reliable 389-ds service on RHEL9, no matter if we take the distribution package or our own build (tested almost all branches - currently tracking 2.5).
Any progress on this (crashes on RHEL9, probably related to spurious and unexplainable server-busy logs) highly appreciated!
Thansk a lot in advance!
@gudtanha this is a link to an internal project, it shouldn't be here in the first place, sorry.
I see you opened #6393, but it lacks information how to reproduce the issue, logs or any information about crashes.
If you have a RHEL/RHDS subscription with support, please open a support case. Support will help you to gather debug information, and it will allow us to prioritize work on your issue.
We migrated from rock solid 1.3.10 CentOS7 to RHEL9 and every >1.4 version crashes and/or soft-locks in the memberOf plugin. We couldn't manage to get any reliable 389-ds service on RHEL9, no matter if we take the distribution package or our own build (tested almost all branches - currently tracking 2.5).
Here's one example of one of our self-destroying instances - it happens after a few days of operation as single-supplier with 6 consumers:
@gudtanha please open a separate ticket, this is unrelated to the current issue.
And also provide more detailed steps to reproduce the crash. Stack trace alone is not helpful, unless we know the reproducer.
@abeisemb FYI: now that the crash fix has been pushed upstream nothing prevents you to go ahead and fix the test_betxn_modrdn_memberof_cache_corruption testcase as planned ...
Activity
abeisemb commentedon Feb 12, 2025
It seems to me that the best way to resolve this is to force a wait until the standalone topology is "free", so to speak. Python is synchronous by default, so I don't think splitting the function into threads would solve the root cause: the first group.rename() call is finished by the time the second one is called, but the server isn't ready.
Hopefully there's a lib389 function or method to ensure the standalone topology isn't busy. Otherwise, I'll probably have to go with the time.sleep() solution. The main solutions I see in dirsrvtests for issues involving time are to sleep, wait, or start threads.
progier389 commentedon Feb 13, 2025
FYI:
The server seldom returns LDAP_BUSY:
It happens when there are too many retries (txn lock conflict) or a conflict in the entry cache after an aborted transaction
As the scenario stress testys the aborted transaction case, sometime getting LDAP_BUSY looks normal.
The usual way to handle LDAP_BUSY (if it is not a bug on the server side) is to wait a bit then retry the operation in a loop: i,e:
retry_if_busy(lambda : managed_entry_user_conn.rename("cn=modrdn group"))
def retry_if_busy(f):
while True:
try:
return f()
except ldap.LDAP_BUSY:
time.sleep(0.02)
abeisemb commentedon Feb 14, 2025
I see, thanks for the advice. In all my runs, this test has returned LDAP_BUSY on the 1minutetip machines without intervention i.e. sleep(2), but this method seems more flexible and better suited to solve the actual issue.
abeisemb commentedon Feb 17, 2025
Curiously, this solution causes the entire standalone topology to go down on RHEL 9 machines. Barring a significant misconfiguration on my part, I think this has to do with an interaction involving the group.rename() exception being caught in the try except block, and then rerunning group.rename() after the exception is caught. This can be in the while loop, or simply having another rename() call after the except block. Sleeping for longer doesn't seem to make a difference (I tried up to 120 seconds).
The exact same code block causes the test to succeed on RHEL 8 machines; I checked for differences in the group.rename() definition between branches, but I haven't found anything yet. It may be some difference in RHEL itself, or a consequence of larger differences between 389-ds-base branches.
progier389 commentedon Feb 18, 2025
Can you precise ?
Is ns-slapd crashing (i.e generating a core) ?
in this case
coredumpctl debugshould help to see the crashing stackOr is is doing a shutdown ? In this cased there should be some messages in the error log
abeisemb commentedon Feb 18, 2025
There looks to be a coredump caused by ns-slapd. First, py.test returns the error
ldap.SERVER_DOWN: {'result': -1, 'desc': "Can't contact LDAP server", 'errno': 104, 'ctrls': [], 'info': 'target entry busy because of a canceled operation'}.There is also an error log from the topology used in the test:
------------------ Extract of instance standalone1 error log -------------------[18/Feb/2025:09:11:57.565847243 -0500] - ERR - oc_check_allowed_sv - Entry "uid=testuser,ou=People,dc=example,dc=com" -- attribute "memberOf" not allowed[18/Feb/2025:09:11:57.569440480 -0500] - ERR - oc_check_allowed_sv - Entry "uid=testuser,ou=People,dc=example,dc=com" -- attribute "memberOf" not allowed[18/Feb/2025:09:11:57.570851725 -0500] - ERR - memberof-plugin - memberof_postop_modrdn - Update failed for (cn=group,ou=Groups,dc=example,dc=com), error (65)Finally, coredumpctl debug shows a generated core:
Core was generated by `/usr/sbin/ns-slapd -D /etc/dirsrv/slapd-standalone1 -i /run/dirsrv/slapd-standa'.Program terminated with signal SIGSEGV, Segmentation fault.#0 0x00007f74fdb97e48 in backentry_get_ndn (e=e@entry=0x0) at ldap/servers/slapd/back-ldbm/backentry.c:9999 return (char *)slapi_sdn_get_ndn(slapi_entry_get_sdn_const(e->ep_entry));[Current thread is 1 (Thread 0x7f70ea9ef640 (LWP 16170))]The test run also returned a full stack trace I can share if necessary.
Backtracing in
coredumpctl debugleads me tobackentry_get_ndn (e=e@entry=0x0) at ldap/servers/slapd/back-ldbm/backentry.c:99. Might be relevant, will continue investigating.progier389 commentedon Feb 18, 2025
Interesting!
FYI:
I do not reproduce the issue on Fedora with main but I reproduce it on latyest RHEL 9 build :
RHEL-9.6.0-20250210.2: with 389-ds-base-2.6.1-2.el9
So we have clearly a problem on RHEL-9
abeisemb commentedon Feb 18, 2025
Didn't reproduce this issue on RHEL-10 beta either using the latest RHEL 10 build (389-ds-base-3.0.6-2.el10.x86_64). Looks to be specific to RHEL 9.
progier389 commentedon Feb 19, 2025
Traiged: https://issues.redhat.com/browse/IDMDS-5288
gudtanha commentedon Feb 28, 2025
Neither of my subscriptions is allowed to view the content.
Not a problem generally - can't contribute much anyways.
BUT: Please fix this bug - whatever the reason for it may be :-) Please share a solution/workaround (perferably with explanation) as soon as possible.
We migrated from rock solid 1.3.10 CentOS7 to RHEL9 and every >1.4 version crashes and/or soft-locks in the memberOf plugin.
We couldn't manage to get any reliable 389-ds service on RHEL9, no matter if we take the distribution package or our own build (tested almost all branches - currently tracking 2.5).
Any progress on this (crashes on RHEL9, probably related to spurious and unexplainable server-busy logs) highly appreciated!
Thansk a lot in advance!
vashirov commentedon Feb 28, 2025
@gudtanha this is a link to an internal project, it shouldn't be here in the first place, sorry.
I see you opened #6393, but it lacks information how to reproduce the issue, logs or any information about crashes.
If you have a RHEL/RHDS subscription with support, please open a support case. Support will help you to gather debug information, and it will allow us to prioritize work on your issue.
gudtanha commentedon Feb 28, 2025
Here's one example of one of our self-destroying instances - it happens after a few days of operation as single-supplier with 6 consumers:
Command Line: /usr/sbin/ns-slapd -D /etc/dirsrv/slapd-comdir -i /run/dirsrv/slapd-comdir.pid
Executable: /usr/sbin/ns-slapd
Control Group: /system.slice/system-dirsrv.slice/dirsrv@comdir.service
Unit: dirsrv@comdir.service
Slice: system-dirsrv.slice
Boot ID:
Machine ID:
Hostname:
Storage: /var/lib/systemd/coredump/core.ns-slapd.389.b1c1a263ed484c30b65589320abc8ff2.3377240.1740743027000000.zst (present)
Size on Disk: 70.3M
Message: Process 3377240 (ns-slapd) of user 389 dumped core.
Only solution is to create the supplier instance from scratch along with all consumers...
Any fix candidate welcome, will test!
vashirov commentedon Feb 28, 2025
@gudtanha please open a separate ticket, this is unrelated to the current issue.
And also provide more detailed steps to reproduce the crash. Stack trace alone is not helpful, unless we know the reproducer.
progier389 commentedon Mar 27, 2025
@abeisemb FYI: now that the crash fix has been pushed upstream nothing prevents you to go ahead and fix the test_betxn_modrdn_memberof_cache_corruption testcase as planned ...
abeisemb commentedon Mar 27, 2025
Acknowledged, I'll submit an MR in the next few days.
Issue 6595 - Regression test failing with ldap.BUSY
Issue 6595 - Regression test in betxn_test.py failing due to busy LDA…
Issue 6595 - Regression test in betxn_test.py failing due to busy LDA…
Issue 6595 - Regression test in betxn_test.py failing due to busy LDA…