ldap/servers/slapd/abandon.c | 2 +-
ldap/servers/slapd/connection.c | 4 ++--
ldap/servers/slapd/opshared.c | 6 ++++++
ldap/servers/slapd/pagedresults.c | 8 +++++++-
ldap/servers/slapd/proto-slap.h | 2 +-
5 files changed, 17 insertions(+), 5 deletions(-)
New commits:
commit d2960e2165a5f27507d4abc8621a7c10721720e0
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Thu Jul 7 11:38:00 2011 -0600
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
diff --git a/ldap/servers/slapd/abandon.c b/ldap/servers/slapd/abandon.c
index 52c4596..8870364 100644
--- a/ldap/servers/slapd/abandon.c
+++ b/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",
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
index d6b23f5..b95759a 100644
--- a/ldap/servers/slapd/connection.c
+++ b/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()) {
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
index 3f022aa..b65507b 100644
--- a/ldap/servers/slapd/opshared.c
+++ b/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
diff --git a/ldap/servers/slapd/pagedresults.c b/ldap/servers/slapd/pagedresults.c
index 0ec63a6..c77ec27 100644
--- a/ldap/servers/slapd/pagedresults.c
+++ b/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;
}
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index e24e1ff..fb9554b 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/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);