Re: [PATCH] prevent slapd from hanging under unlikely circumstances

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 1/31/20 9:10 PM, Jay Fenlason wrote:
I have a small FreeIPA deployment of ~6-8 servers running on Centos
7.7.  Do to the addition and removal of some of the servers, some
cruft (tombstones, replication conflicts, etc) have crept in to the
directory.  I noticed that when I attempted to delete some of the
cruft entries, ns-slapd would hang, failirg to process requests, or
even shut down.  In my investigation I found that pre-write callback
of the plugins (including the nis plugin) were being called, but no
corresponding post-write call was happening.  The nis plugin takes a
write lock in the pre-write callback and releases it in the post-write
callback.  Never releasing the lock causes the next attempt to take it
to hang.  I wrote the attached patch, which simply ensures the
post-write callback is always called if the pre-write callback was
called.

I need to look at this closer, but I would suspect you should not ignore the check for delete_tombstone_entry:

+    if (pre_delete_called) {

To

+    if (pre_delete_called || !delete_tombstone_entry) {


Does it still resolve your problem?  Probably, but best to check...

Like I said this needs a closer investigation/testing to make sure it does not cause any regressions.  Do you have a stack trace from the hang you encountered?  If not, could you get one for us?

Thanks,
Mark


This is such a simple patch that it scarcely needs a signoff.
Nonetheless:

Signed-off-by: Jay Fenlason <ds389@xxxxxxxxxxxxxxx>

--- a/ldap/servers/slapd/back-ldbm/ldbm_delete.c.orig	2020-01-31 07:28:04.085861174 -0500
+++ b/ldap/servers/slapd/back-ldbm/ldbm_delete.c	2020-01-31 07:30:33.932947489 -0500
@@ -81,6 +81,7 @@
      Connection *pb_conn;
      int32_t parent_op = 0;
      struct timespec parent_time;
+    int pre_delete_called = 0;
if (slapi_pblock_get(pb, SLAPI_CONN_ID, &conn_id) < 0) {
          conn_id = 0; /* connection is NULL */
@@ -371,6 +372,7 @@
                  }
                  if (retval == 0) {
                      retval = plugin_call_plugins(pb, SLAPI_PLUGIN_BE_PRE_DELETE_FN);
+		    pre_delete_called = 1;
                  }
                  if (retval)
                  {
@@ -1491,7 +1493,7 @@
       * The bepostop is called even if the operation fails,
       * but not if the operation is purging tombstones.
       */
-    if (!delete_tombstone_entry) {
+    if (pre_delete_called) {
          plugin_call_plugins(pb, SLAPI_PLUGIN_BE_POST_DELETE_FN);
      }
      /* Need to return to cache after post op plugins are called */
_______________________________________________
389-devel mailing list -- 389-devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to 389-devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/389-devel@xxxxxxxxxxxxxxxxxxxxxxx

--

389 Directory Server Development Team
_______________________________________________
389-devel mailing list -- 389-devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to 389-devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/389-devel@xxxxxxxxxxxxxxxxxxxxxxx




[Index of Archives]     [Fedora Directory Announce]     [Fedora Users]     [Older Fedora Users Mail]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Review]     [Fedora Art]     [Fedora Music]     [Fedora Packaging]     [CentOS]     [Fedora SELinux]     [Big List of Linux Books]     [KDE Users]     [Fedora Art]     [Fedora Docs]

  Powered by Linux