From e544dad0a8b41069a715a75b700e16c238d32a4e Mon Sep 17 00:00:00 2001
From: Quanah Gibson-Mount <quanah@openldap.org>
Date: Thu, 12 Mar 2009 17:42:01 +0000
Subject: [PATCH] ITS#6011

---
 CHANGES                  | 1 +
 servers/slapd/syncrepl.c | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/CHANGES b/CHANGES
index 856e5dc6ff..e336d03ade 100644
--- a/CHANGES
+++ b/CHANGES
@@ -11,6 +11,7 @@ OpenLDAP 2.4.16 Engineering
 	Fixed slapd ctxcsn race condition (ITS#6001)
 	Fixed slapd syncrepl newCookie sync messages (ITS#5972)
 	Fixed slapd syncrepl multiple CSN propagation (ITS#5973)
+	Fixed slapd syncrepl hang during shutdown (ITS#6011)
 	Fixed slapd-bdb/hdb cachesize handling (ITS#5860)
 	Fixed slapd-bdb/hdb with slapcat with empty dn (ITS#6006)
 	Fixed slapd-ldap incorrect referral handling (ITS#6003,ITS#5916)
diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c
index 7ad5c813ab..ad38463a62 100644
--- a/servers/slapd/syncrepl.c
+++ b/servers/slapd/syncrepl.c
@@ -1260,6 +1260,8 @@ do_syncrepl(
 
 	/* Don't get stuck here while a pause is initiated */
 	while ( ldap_pvt_thread_mutex_trylock( &si->si_mutex )) {
+		if ( slapd_shutdown )
+			return NULL;
 		if ( !ldap_pvt_thread_pool_pausecheck( &connection_pool ))
 			ldap_pvt_thread_yield();
 	}
-- 
GitLab