1
0
Эх сурвалжийг харах

Bug 735121 - simple paged search + ip/dns based ACI hangs server

https://bugzilla.redhat.com/show_bug.cgi?id=735121
Resolves: bug 735121
Bug Description: simple paged search + ip/dns based ACI hangs server
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description: The pb_conn->c_mutex lock around be->be_next_search_entry()
was too big.  Other code inside be->be_next_search_entry needs to lock
the conn.  In this particular case, the aci code needed to access the
client ip address from the conn object.  The fix is to remove the mutex
around be->be_next_search_entry() in iterate() and instead make sure
code that accesses pb_conn locks first.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
Rich Megginson 14 жил өмнө
parent
commit
b5f77c693d

+ 5 - 5
ldap/servers/slapd/back-ldbm/ldbm_search.c

@@ -1228,7 +1228,7 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
         if ( slapi_op_abandoned( pb ) || (NULL == sr) )
         {
             /* in case paged results, clean up the conn */
-            pagedresults_set_search_result(pb->pb_conn, NULL, 1);
+            pagedresults_set_search_result(pb->pb_conn, NULL, 0);
             slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET, NULL );
             slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET_SIZE_ESTIMATE, &estimate );
             if ( use_extension ) {
@@ -1245,7 +1245,7 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
         if ( tlimit != -1 && curtime > stoptime )
         {
             /* in case paged results, clean up the conn */
-            pagedresults_set_search_result(pb->pb_conn, NULL, 1);
+            pagedresults_set_search_result(pb->pb_conn, NULL, 0);
             slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET, NULL );
             slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET_SIZE_ESTIMATE, &estimate );
             if ( use_extension ) {
@@ -1262,7 +1262,7 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
         if ( llimit != -1 && sr->sr_lookthroughcount >= llimit )
         {
             /* in case paged results, clean up the conn */
-            pagedresults_set_search_result(pb->pb_conn, NULL, 1);
+            pagedresults_set_search_result(pb->pb_conn, NULL, 0);
             slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET, NULL );
             slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET_SIZE_ESTIMATE, &estimate );
             if ( use_extension ) {
@@ -1282,7 +1282,7 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
             /* No more entries */
             /* destroy back_search_result_set */
             /* in case paged results, clean up the conn */
-            pagedresults_set_search_result(pb->pb_conn, NULL, 1);
+            pagedresults_set_search_result(pb->pb_conn, NULL, 0);
             slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET, NULL );
             slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET_SIZE_ESTIMATE, &estimate );
             if ( use_extension ) {
@@ -1425,7 +1425,7 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
                      if ( --slimit < 0 ) {
                          CACHE_RETURN( &inst->inst_cache, &e );
                          /* in case paged results, clean up the conn */
-                         pagedresults_set_search_result(pb->pb_conn, NULL, 1);
+                         pagedresults_set_search_result(pb->pb_conn, NULL, 0);
                          slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET, NULL );
                          slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET_SIZE_ESTIMATE, &estimate );
                          delete_search_result_set( &sr );

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

@@ -1150,19 +1150,7 @@ iterate(Slapi_PBlock *pb, Slapi_Backend *be, int send_result,
 
         slapi_pblock_get (pb, SLAPI_OPERATION, &operation);
         is_paged = operation->o_flags & OP_FLAG_PAGED_RESULTS;
-        /* 
-         * If it is paged results, the search result set could be released when
-         * it reaches the timelimit.  This lock protects the search result set
-         * not to be released while sending a next entry.
-         * (see pagedresults_cleanup called from disconnect_server_nomutex)
-         */
-        if ( is_paged && pb->pb_conn && pb->pb_conn->c_mutex ) {
-            PR_Lock( pb->pb_conn->c_mutex );
-        }
         rc = be->be_next_search_entry(pb);
-        if ( is_paged && pb->pb_conn && pb->pb_conn->c_mutex ) {
-            PR_Unlock( pb->pb_conn->c_mutex );
-        }
         if (rc < 0) 
         {
             /*