Blame SOURCES/0001-Issue-49170-sync-plugin-thread-count-not-handled-cor.patch

6f51e1
From a00917eec0bcef75180eaf4dd9b360519b9e2644 Mon Sep 17 00:00:00 2001
6f51e1
From: Mark Reynolds <mreynolds@redhat.com>
6f51e1
Date: Tue, 14 Mar 2017 14:35:05 -0400
6f51e1
Subject: [PATCH 2/5] Issue 49170 - sync plugin thread count not handled
6f51e1
 correctly
6f51e1
6f51e1
Bug Description:  If sync repl connections get aborted the thread_count is
6f51e1
                  not properly updated which leads to the server hanging
6f51e1
                  on shutdown.
6f51e1
6f51e1
Fix Description:  When connections get aborted we still need to shutdown
6f51e1
                  the result thread cleanly:  remove the req, update thread
6f51e1
                  count, etc.
6f51e1
6f51e1
https://pagure.io/389-ds-base/issue/49170
6f51e1
6f51e1
Reviewed by: nhosoi(Thanks!)
6f51e1
6f51e1
(cherry picked from commit 770fcf4349ccf9e07ff0e1cf0d6991927ec9ba75)
6f51e1
---
6f51e1
 ldap/servers/plugins/sync/sync_persist.c | 17 ++++++++---------
6f51e1
 1 file changed, 8 insertions(+), 9 deletions(-)
6f51e1
6f51e1
diff --git a/ldap/servers/plugins/sync/sync_persist.c b/ldap/servers/plugins/sync/sync_persist.c
6f51e1
index d0c8da2..667a529 100644
6f51e1
--- a/ldap/servers/plugins/sync/sync_persist.c
6f51e1
+++ b/ldap/servers/plugins/sync/sync_persist.c
6f51e1
@@ -548,16 +548,16 @@ sync_send_results( void *arg )
6f51e1
 	slapi_pblock_get(req->req_pblock, SLAPI_CONNECTION, &conn);
6f51e1
 	if (NULL == conn) {
6f51e1
 		slapi_log_err(SLAPI_LOG_ERR, SYNC_PLUGIN_SUBSYSTEM,
6f51e1
-						"sync_send_results - conn=%" NSPRIu64 " op=%d Null connection - aborted\n",
6f51e1
-						connid, opid);
6f51e1
-		return;
6f51e1
+			"sync_send_results - conn=%" NSPRIu64 " op=%d Null connection - aborted\n",
6f51e1
+			connid, opid);
6f51e1
+		goto done;
6f51e1
 	}
6f51e1
 	conn_acq_flag = sync_acquire_connection (conn);
6f51e1
 	if (conn_acq_flag) {
6f51e1
 		slapi_log_err(SLAPI_LOG_ERR, SYNC_PLUGIN_SUBSYSTEM,
6f51e1
-						"sync_send_results - conn=%" NSPRIu64 " op=%d Could not acquire the connection - aborted\n",
6f51e1
-						connid, opid);
6f51e1
-		return;
6f51e1
+			"sync_send_results - conn=%" NSPRIu64 " op=%d Could not acquire the connection - aborted\n",
6f51e1
+			connid, opid);
6f51e1
+		goto done;
6f51e1
 	}
6f51e1
 
6f51e1
 	PR_Lock( sync_request_list->sync_req_cvarlock );
6f51e1
@@ -658,15 +658,14 @@ sync_send_results( void *arg )
6f51e1
 		}
6f51e1
 	}
6f51e1
 	PR_Unlock( sync_request_list->sync_req_cvarlock );
6f51e1
-	sync_remove_request( req );
6f51e1
 
6f51e1
 	/* indicate the end of search */
6f51e1
-
6f51e1
 	sync_release_connection(req->req_pblock, conn, op, conn_acq_flag == 0);
6f51e1
 
6f51e1
+done:
6f51e1
+	sync_remove_request( req );
6f51e1
 	PR_DestroyLock ( req->req_lock );
6f51e1
 	req->req_lock = NULL;
6f51e1
-
6f51e1
 	slapi_ch_free((void **) &req->req_pblock );
6f51e1
 	slapi_ch_free((void **) &req->req_orig_base );
6f51e1
 	slapi_filter_free(req->req_filter, 1);
6f51e1
-- 
6f51e1
2.9.3
6f51e1