https://bugs.openldap.org/show_bug.cgi?id=9789
Issue ID: 9789 Summary: syncprov uses a thread-local counters for the detached op Product: OpenLDAP Version: unspecified Hardware: All OS: All Status: UNCONFIRMED Keywords: needs_review Severity: normal Priority: --- Component: slapd Assignee: bugs@openldap.org Reporter: ondra@mistotebe.net Target Milestone: ---
Persistent searches routinely migrate across threads, however they keep using op->o_counters from the original search op which is meant to be thread-local. During shutdown, this counter can be destroyed as the original thread finishes, but the persistent search might still be live somewhere else. At that point, trying to acquire the destroyed sc_mutex fails and the thread usually stalls forever.
slapd-asyncmeta is very likely to suffer from the same issues.
A representative backtrace of this happening: Thread 3 (Thread 0x7f0b7d933640 (LWP 2928392) "slapd"): #0 futex_wait (private=0, expected=2, futex_word=0x7f0b74000ff8) at ../sysdeps/nptl/futex-internal.h:146 #3 0x00007f0b7fd17a05 in ldap_pvt_thread_mutex_lock (mutex=Locked by LWP 0) at thr_posix.c:313 #4 0x0000000000469564 in slap_send_search_entry (op=Search request conn=1003 op=1 = {...}, rs=Search entry = {...}) at result.c:1503 #5 0x00007f0b7f30561c in syncprov_sendresp (op=Search request conn=1003 op=1 = {...}, ri=0x7f0b701eb8e0, so=0x7f0b74102b20, mode=1) at syncprov.c:976 #6 0x00007f0b7f305064 in syncprov_qplay (op=Search request conn=1003 op=1 = {...}, so=0x7f0b74102b20) at syncprov.c:1028 #7 0x00007f0b7f304ecc in syncprov_qtask (ctx=0x7f0b7d932a58, arg=0x7f0b74102b20) at syncprov.c:1086
https://bugs.openldap.org/show_bug.cgi?id=9789
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords|needs_review | Ever confirmed|0 |1 Target Milestone|--- |2.5.12 Assignee|bugs@openldap.org |ondra@mistotebe.net Status|UNCONFIRMED |IN_PROGRESS
--- Comment #1 from Quanah Gibson-Mount quanah@openldap.org --- https://git.openldap.org/openldap/openldap/-/merge_requests/481
https://bugs.openldap.org/show_bug.cgi?id=9789
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|IN_PROGRESS |RESOLVED
--- Comment #2 from Quanah Gibson-Mount quanah@openldap.org --- head:
• ebfbf828 by Ondřej Kuzník at 2022-01-26T18:55:41+00:00 ITS#9789 Expose operation_counter_init
• ebc73697 by Ondřej Kuzník at 2022-01-26T18:55:41+00:00 ITS#9789 slapo-syncprov: Reset op->o_counters every time we migrate to a new thread
• f5d86968 by Ondřej Kuzník at 2022-01-26T18:55:41+00:00 ITS#9789 slapd-asyncmeta: Reset op->o_counters every time we migrate to a new thread
• 209ee9b0 by Ondřej Kuzník at 2022-01-26T18:55:41+00:00 ITS#9789 slapo-vc: Reset op->o_counters every time we migrate to a new thread
RE26:
• 4118a8d8 by Ondřej Kuzník at 2022-01-31T20:05:21+00:00 ITS#9789 Expose operation_counter_init
• 84ea1426 by Ondřej Kuzník at 2022-01-31T20:05:25+00:00 ITS#9789 slapo-syncprov: Reset op->o_counters every time we migrate to a new thread
• 8871a074 by Ondřej Kuzník at 2022-01-31T20:05:28+00:00 ITS#9789 slapd-asyncmeta: Reset op->o_counters every time we migrate to a new thread
• dfc9efb8 by Ondřej Kuzník at 2022-01-31T20:05:32+00:00 ITS#9789 slapo-vc: Reset op->o_counters every time we migrate to a new thread
RE25:
• b84eddaf by Ondřej Kuzník at 2022-02-02T17:12:15+00:00 ITS#9789 Expose operation_counter_init
• 2fdcca79 by Ondřej Kuzník at 2022-02-02T17:12:19+00:00 ITS#9789 slapo-syncprov: Reset op->o_counters every time we migrate to a new thread
• 6cd3cc76 by Ondřej Kuzník at 2022-02-02T17:12:23+00:00 ITS#9789 slapd-asyncmeta: Reset op->o_counters every time we migrate to a new thread
• 5e1531e1 by Ondřej Kuzník at 2022-02-02T17:12:27+00:00 ITS#9789 slapo-vc: Reset op->o_counters every time we migrate to a new thread
• d1490013 by Quanah Gibson-Mount at 2022-02-02T17:12:44+00:00 ITS#9789
https://bugs.openldap.org/show_bug.cgi?id=9789
--- Comment #3 from Quanah Gibson-Mount quanah@openldap.org --- head:
• 94d5180f by Howard Chu at 2022-05-02T17:40:19+01:00 ITS#9789 slapo-vc: fix typo in prev commit
RE26:
• 75ca4779 by Howard Chu at 2022-05-02T17:12:39+00:00 ITS#9789 slapo-vc: fix typo in prev commit
RE25:
• 1d3fb3cc by Howard Chu at 2022-05-02T17:13:06+00:00 ITS#9789 slapo-vc: fix typo in prev commit
https://bugs.openldap.org/show_bug.cgi?id=9789
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |VERIFIED