Ver Fonte

Bug 709468 - RSA Authentication Server timeouts when using simple paged results on RHDS 8.2.

https://bugzilla.redhat.com/show_bug.cgi?id=709468
Resolves: bug 709468
Bug Description: RSA Authentication Server timeouts when using simple paged results on RHDS 8.2.
Reviewed by: nkinder, nhosoi (Thanks!)
Branch: master
Fix Description: When returning the last page of the last result set, in the
searchResultDone message, the paged results cookie is set to NULL.  This
means the client cannot issue another search using this result set/cookie,
which means the server can free/reset the simple paged resources
associated with this result set.  Use pagedresults_cleanup() to do this.
Since before it was assumed pagedresults_cleanup was called with the
connection lock, a new parameter tells it if it needs to lock or not.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
Rich Megginson há 14 anos atrás
pai
commit
d2960e2165

+ 1 - 1
ldap/servers/slapd/abandon.c

@@ -152,7 +152,7 @@ do_abandon( Slapi_PBlock *pb )
 		    0 );
 	}
 
-	if (pagedresults_cleanup(pb->pb_conn)) {
+	if (pagedresults_cleanup(pb->pb_conn, 0 /* already locked */)) {
 		/* Cleaned up paged result connection */
 		slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d ABANDON"
 			" targetop=Simple Paged Results\n",

+ 2 - 2
ldap/servers/slapd/connection.c

@@ -201,7 +201,7 @@ connection_cleanup(Connection *conn)
 	/* destroy any sasl context */
 	sasl_dispose((sasl_conn_t**)&conn->c_sasl_conn);
 	/* PAGED_RESULTS */
-	pagedresults_cleanup(conn);
+	pagedresults_cleanup(conn, 0 /* do not need to lock inside */);
 
 	/* free the connection socket buffer */
 	connection_free_private_buffer(conn);
@@ -2767,7 +2767,7 @@ disconnect_server_nomutex( Connection *conn, PRUint64 opconnid, int opid, PRErro
 	conn->c_gettingber = 0;
 	connection_abandon_operations( conn );
 
-	pagedresults_cleanup(conn); /* In case the connection is on pagedresult.
+	pagedresults_cleanup(conn, 0 /* already locked */); /* In case the connection is on pagedresult.
 	                            Better to call it after the op is abandened. */
 
 	if (! config_check_referral_mode()) {

+ 6 - 0
ldap/servers/slapd/opshared.c

@@ -625,6 +625,9 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
       }
       pagedresults_set_search_result_set_size_estimate(pb->pb_conn, estimate);
       next_be = NULL; /* to break the loop */
+      if (curr_search_count == -1) {
+        pagedresults_cleanup(pb->pb_conn, 1 /* need to lock */);
+      }
     } else {
       /* be_suffix null means that we are searching the default backend
        * -> don't change the search parameters in pblock
@@ -766,6 +769,9 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
                                               estimate, curr_search_count);
             slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET, NULL );
             next_be = NULL; /* to break the loop */
+            if (curr_search_count == -1) {
+                pagedresults_cleanup(pb->pb_conn, 1 /* need to lock */);
+            }
         }
   
         /* if rc != 0 an error occurred while sending back the entries

+ 7 - 1
ldap/servers/slapd/pagedresults.c

@@ -370,10 +370,13 @@ pagedresults_set_timelimit(Connection *conn, time_t timelimit)
  * 1: simple paged result and successfully abandoned
  */
 int
-pagedresults_cleanup(Connection *conn)
+pagedresults_cleanup(Connection *conn, int needlock)
 {
     int rc = 0;
 
+    if (needlock) {
+        PR_Lock(conn->c_mutex);
+    }
     if (conn->c_current_be) {
         if (conn->c_search_result_set) {
             if (conn->c_current_be->be_search_results_release) {
@@ -387,6 +390,9 @@ pagedresults_cleanup(Connection *conn)
     conn->c_search_result_count = 0;
     conn->c_timelimit = 0;
     conn->c_flags &= ~CONN_FLAG_PAGEDRESULTS_PROCESSING;
+    if (needlock) {
+        PR_Unlock(conn->c_mutex);
+    }
     return rc;
 }
 

+ 1 - 1
ldap/servers/slapd/proto-slap.h

@@ -1386,7 +1386,7 @@ int pagedresults_set_unindexed(Connection *conn);
 int pagedresults_get_sort_result_code(Connection *conn);
 int pagedresults_set_sort_result_code(Connection *conn, int code);
 int pagedresults_set_timelimit(Connection *conn, time_t timelimit);
-int pagedresults_cleanup(Connection *conn);
+int pagedresults_cleanup(Connection *conn, int needlock);
 int pagedresults_check_or_set_processing(Connection *conn);
 int pagedresults_reset_processing(Connection *conn);