|
|
dc8c34 |
From 6f8a10320f6436c76bae3cd46a496e36cb034409 Mon Sep 17 00:00:00 2001
|
|
|
dc8c34 |
From: Mark Reynolds <mreynolds@redhat.com>
|
|
|
dc8c34 |
Date: Fri, 7 Jun 2013 11:41:38 -0400
|
|
|
dc8c34 |
Subject: [PATCH 66/99] Ticket 47383 - connections attribute in
|
|
|
dc8c34 |
cn=snmp,cn=monitor is counted twice
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Bug Description: In disconnect_server_nomutex() we increment, instead of decrement
|
|
|
dc8c34 |
the connection counter.
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Fix Description: Decrement the counter. Also did some code cleanup.
|
|
|
dc8c34 |
|
|
|
dc8c34 |
https://fedorahosted.org/389/ticket/47383
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Reviewed by: Richm(Thanks!)
|
|
|
dc8c34 |
(cherry picked from commit 202c9831194558a7439da815f6627993ce1a17db)
|
|
|
dc8c34 |
(cherry picked from commit accea11ad4e16ad57b319b7c7091301adf33a99e)
|
|
|
dc8c34 |
---
|
|
|
dc8c34 |
ldap/servers/slapd/connection.c | 129 ++++++++++++++++++++--------------------
|
|
|
dc8c34 |
1 file changed, 65 insertions(+), 64 deletions(-)
|
|
|
dc8c34 |
|
|
|
dc8c34 |
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
|
|
|
dc8c34 |
index a3b1df5..1d1adac 100644
|
|
|
dc8c34 |
--- a/ldap/servers/slapd/connection.c
|
|
|
dc8c34 |
+++ b/ldap/servers/slapd/connection.c
|
|
|
dc8c34 |
@@ -2737,77 +2737,78 @@ void
|
|
|
dc8c34 |
disconnect_server_nomutex( Connection *conn, PRUint64 opconnid, int opid, PRErrorCode reason, PRInt32 error )
|
|
|
dc8c34 |
{
|
|
|
dc8c34 |
if ( ( conn->c_sd != SLAPD_INVALID_SOCKET &&
|
|
|
dc8c34 |
- conn->c_connid == opconnid ) && !(conn->c_flags & CONN_FLAG_CLOSING) ) {
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
- /*
|
|
|
dc8c34 |
- * PR_Close must be called before anything else is done because
|
|
|
dc8c34 |
- * of NSPR problem on NT which requires that the socket on which
|
|
|
dc8c34 |
- * I/O timed out is closed before any other I/O operation is
|
|
|
dc8c34 |
- * attempted by the thread.
|
|
|
dc8c34 |
- * WARNING : As of today the current code does not fulfill the
|
|
|
dc8c34 |
- * requirements above.
|
|
|
dc8c34 |
- */
|
|
|
dc8c34 |
+ conn->c_connid == opconnid ) && !(conn->c_flags & CONN_FLAG_CLOSING) )
|
|
|
dc8c34 |
+ {
|
|
|
dc8c34 |
+ /*
|
|
|
dc8c34 |
+ * PR_Close must be called before anything else is done because
|
|
|
dc8c34 |
+ * of NSPR problem on NT which requires that the socket on which
|
|
|
dc8c34 |
+ * I/O timed out is closed before any other I/O operation is
|
|
|
dc8c34 |
+ * attempted by the thread.
|
|
|
dc8c34 |
+ * WARNING : As of today the current code does not fulfill the
|
|
|
dc8c34 |
+ * requirements above.
|
|
|
dc8c34 |
+ */
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- /* Mark that the socket should be closed on this connection.
|
|
|
dc8c34 |
- * We don't want to actually close the socket here, because
|
|
|
dc8c34 |
- * the listener thread could be PR_Polling over it right now.
|
|
|
dc8c34 |
- * The last thread to stop using the connection will do the closing.
|
|
|
dc8c34 |
- */
|
|
|
dc8c34 |
- conn->c_flags |= CONN_FLAG_CLOSING;
|
|
|
dc8c34 |
- g_decrement_current_conn_count();
|
|
|
dc8c34 |
+ /* Mark that the socket should be closed on this connection.
|
|
|
dc8c34 |
+ * We don't want to actually close the socket here, because
|
|
|
dc8c34 |
+ * the listener thread could be PR_Polling over it right now.
|
|
|
dc8c34 |
+ * The last thread to stop using the connection will do the closing.
|
|
|
dc8c34 |
+ */
|
|
|
dc8c34 |
+ conn->c_flags |= CONN_FLAG_CLOSING;
|
|
|
dc8c34 |
+ g_decrement_current_conn_count();
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- /*
|
|
|
dc8c34 |
- * Print the error captured above.
|
|
|
dc8c34 |
- */
|
|
|
dc8c34 |
- if (error && (EPIPE != error) ) {
|
|
|
dc8c34 |
- slapi_log_access( LDAP_DEBUG_STATS,
|
|
|
dc8c34 |
- "conn=%" NSPRIu64 " op=%d fd=%d closed error %d (%s) - %s\n",
|
|
|
dc8c34 |
- conn->c_connid, opid, conn->c_sd, error,
|
|
|
dc8c34 |
- slapd_system_strerror(error),
|
|
|
dc8c34 |
- slapd_pr_strerror(reason));
|
|
|
dc8c34 |
- } else {
|
|
|
dc8c34 |
- slapi_log_access( LDAP_DEBUG_STATS,
|
|
|
dc8c34 |
- "conn=%" NSPRIu64 " op=%d fd=%d closed - %s\n",
|
|
|
dc8c34 |
- conn->c_connid, opid, conn->c_sd,
|
|
|
dc8c34 |
- slapd_pr_strerror(reason));
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
+ /*
|
|
|
dc8c34 |
+ * Print the error captured above.
|
|
|
dc8c34 |
+ */
|
|
|
dc8c34 |
+ if (error && (EPIPE != error) ) {
|
|
|
dc8c34 |
+ slapi_log_access( LDAP_DEBUG_STATS,
|
|
|
dc8c34 |
+ "conn=%" NSPRIu64 " op=%d fd=%d closed error %d (%s) - %s\n",
|
|
|
dc8c34 |
+ conn->c_connid, opid, conn->c_sd, error,
|
|
|
dc8c34 |
+ slapd_system_strerror(error),
|
|
|
dc8c34 |
+ slapd_pr_strerror(reason));
|
|
|
dc8c34 |
+ } else {
|
|
|
dc8c34 |
+ slapi_log_access( LDAP_DEBUG_STATS,
|
|
|
dc8c34 |
+ "conn=%" NSPRIu64 " op=%d fd=%d closed - %s\n",
|
|
|
dc8c34 |
+ conn->c_connid, opid, conn->c_sd,
|
|
|
dc8c34 |
+ slapd_pr_strerror(reason));
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- if (! config_check_referral_mode()) {
|
|
|
dc8c34 |
- slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsConnections);
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
+ if (! config_check_referral_mode()) {
|
|
|
dc8c34 |
+ slapi_counter_decrement(g_get_global_snmp_vars()->ops_tbl.dsConnections);
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- conn->c_gettingber = 0;
|
|
|
dc8c34 |
- connection_abandon_operations( conn );
|
|
|
dc8c34 |
- /* needed here to ensure simple paged results timeout properly and
|
|
|
dc8c34 |
- * don't impact subsequent ops */
|
|
|
dc8c34 |
- pagedresults_reset_timedout_nolock(conn);
|
|
|
dc8c34 |
+ conn->c_gettingber = 0;
|
|
|
dc8c34 |
+ connection_abandon_operations( conn );
|
|
|
dc8c34 |
+ /* needed here to ensure simple paged results timeout properly and
|
|
|
dc8c34 |
+ * don't impact subsequent ops */
|
|
|
dc8c34 |
+ pagedresults_reset_timedout_nolock(conn);
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- if (! config_check_referral_mode()) {
|
|
|
dc8c34 |
- /*
|
|
|
dc8c34 |
- * If any of the outstanding operations on this
|
|
|
dc8c34 |
- * connection were persistent searches, then
|
|
|
dc8c34 |
- * ding all the persistent searches to get them
|
|
|
dc8c34 |
- * to notice that their operations have been abandoned.
|
|
|
dc8c34 |
- */
|
|
|
dc8c34 |
- int found_ps = 0;
|
|
|
dc8c34 |
- Operation *o;
|
|
|
dc8c34 |
+ if (! config_check_referral_mode()) {
|
|
|
dc8c34 |
+ /*
|
|
|
dc8c34 |
+ * If any of the outstanding operations on this
|
|
|
dc8c34 |
+ * connection were persistent searches, then
|
|
|
dc8c34 |
+ * ding all the persistent searches to get them
|
|
|
dc8c34 |
+ * to notice that their operations have been abandoned.
|
|
|
dc8c34 |
+ */
|
|
|
dc8c34 |
+ int found_ps = 0;
|
|
|
dc8c34 |
+ Operation *o;
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- for ( o = conn->c_ops; !found_ps && o != NULL; o = o->o_next ) {
|
|
|
dc8c34 |
- if ( o->o_flags & OP_FLAG_PS ) {
|
|
|
dc8c34 |
- found_ps = 1;
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
- if ( found_ps ) {
|
|
|
dc8c34 |
- if ( NULL == ps_wakeup_all_fn ) {
|
|
|
dc8c34 |
- if ( get_entry_point( ENTRY_POINT_PS_WAKEUP_ALL,
|
|
|
dc8c34 |
- (caddr_t *)(&ps_wakeup_all_fn )) == 0 ) {
|
|
|
dc8c34 |
- (ps_wakeup_all_fn)();
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
- } else {
|
|
|
dc8c34 |
- (ps_wakeup_all_fn)();
|
|
|
dc8c34 |
+ for ( o = conn->c_ops; !found_ps && o != NULL; o = o->o_next ) {
|
|
|
dc8c34 |
+ if ( o->o_flags & OP_FLAG_PS ) {
|
|
|
dc8c34 |
+ found_ps = 1;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ( found_ps ) {
|
|
|
dc8c34 |
+ if ( NULL == ps_wakeup_all_fn ) {
|
|
|
dc8c34 |
+ if ( get_entry_point( ENTRY_POINT_PS_WAKEUP_ALL,
|
|
|
dc8c34 |
+ (caddr_t *)(&ps_wakeup_all_fn )) == 0 )
|
|
|
dc8c34 |
+ {
|
|
|
dc8c34 |
+ (ps_wakeup_all_fn)();
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ } else {
|
|
|
dc8c34 |
+ (ps_wakeup_all_fn)();
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
- }
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
--
|
|
|
dc8c34 |
1.8.1.4
|
|
|
dc8c34 |
|