ldap/servers/slapd/daemon.c | 3 +++
1 file changed, 3 insertions(+)
New commits:
commit d73b5738fbab9f629c5f4d469ec45944b82ead72
Author: Ludwig Krispenz <lkrispen(a)redhat.com>
Date: Wed Jan 13 13:15:53 2016 +0100
Ticket: 48341 - deadlock on connection mutex
If thread is blocked in connection_read_operation() it holds the connection mutex
and the main thread iterating through the connection table is also blocked.
But if the main thread would get the mutex it would just detect that the connection
has still the
C_gettingber flag set and immediately release the lock.
The check if c_gettingber == 0 can be done without holding the mutex and so the
deadlock
can be avoided
Reviewed by Rich, Thanks
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index 3b6acfe..ba7a39a 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -1752,6 +1752,9 @@ handle_pr_read_ready(Connection_Table *ct, PRIntn num_poll)
{
if ( c->c_mutex != NULL )
{
+ /* this check can be done without acquiring the mutex */
+ if (c->c_gettingber) continue;
+
PR_EnterMonitor(c->c_mutex);
if ( connection_is_active_nolock (c) && c->c_gettingber == 0 )
{
Show replies by thread