ldap/servers/slapd/connection.c | 11 +++++++++++
1 file changed, 11 insertions(+)
New commits:
commit 6dec0725ba70e97deefcaec605b5192368e2625c
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Thu Mar 25 15:11:58 2010 -0600
Bug 567429 - slapd didn't close connection and get into CLOSE_WAIT state
https://bugzilla.redhat.com/show_bug.cgi?id=567429
Resolves: bug 567429
Bug Description: slapd didn't close connection and get into CLOSE_WAIT state
Reviewed by: nhosoi (Thanks!)
Branch: Directory_Server_8_2_Branch
Fix Description: The JNDI code attached to the bug uses persistent search.
The connection pool code handles persistent searches differently than
regular connections. The connection pool code was acquiring a reference
to a conn, but was not releasing it in the persistent search case, assuming
the persistent search code did not also have a reference, but it does. This
caused connection_table_move_connection_out_of_active_list() to not move
the connection out of the active list, and therefore available for closing,
because there was an outstanding reference. The solution is for the
connection pool code to release its reference.
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no
(cherry picked from commit 48d50e8f06e0c2fd8e2541c3c239217a6b72ebbc)
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
index 5c8decb..d2b728c 100644
--- a/ldap/servers/slapd/connection.c
+++ b/ldap/servers/slapd/connection.c
@@ -971,6 +971,13 @@ done:
}
PR_Unlock( conn->c_mutex );
+ } else { /* ps code acquires ref to conn - we need to release ours here */
+ PR_Lock( conn->c_mutex );
+ if (connection_release_nolock (conn) != 0)
+ {
+ return_value = -1;
+ }
+ PR_Unlock( conn->c_mutex );
}
return return_value;
}
@@ -2294,6 +2301,10 @@ done:
connection_release_nolock (conn);
}
PR_Unlock( conn->c_mutex );
+ } else { /* the ps code acquires a ref to the conn - we need to release ours here */
+ PR_Lock( conn->c_mutex );
+ connection_release_nolock (conn);
+ PR_Unlock( conn->c_mutex );
}
/* Since we didn't do so earlier, we need to make a replication connection readable
again here */
if ( ((1 == is_timedout) || (replication_connection && !thread_turbo_flag))
&& !more_data)