You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2014/12/02 13:49:43 UTC

svn commit: r1642859 - in /httpd/httpd/branches/2.4.x: ./ STATUS server/mpm/event/event.c server/mpm/event/fdqueue.c

Author: jim
Date: Tue Dec  2 12:49:42 2014
New Revision: 1642859

URL: http://svn.apache.org/r1642859
Log:
Merge r1638879, r1640031 from trunk:

avoid dereferencing a recently apr_pool_clear()'ed event_conn_state_t *cs
in several paths where ptrans is being recycled at the end of a request.



event, eventopt: follow up to r1638879 and r1639960.
Clear the pool in ap_push_pool() before recycling.

Submitted by: covener, ylavic
Reviewed/backported by: jim

Modified:
    httpd/httpd/branches/2.4.x/   (props changed)
    httpd/httpd/branches/2.4.x/STATUS
    httpd/httpd/branches/2.4.x/server/mpm/event/event.c
    httpd/httpd/branches/2.4.x/server/mpm/event/fdqueue.c

Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk:r1638879,1640031

Modified: httpd/httpd/branches/2.4.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/STATUS?rev=1642859&r1=1642858&r2=1642859&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/STATUS (original)
+++ httpd/httpd/branches/2.4.x/STATUS Tue Dec  2 12:49:42 2014
@@ -112,13 +112,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
      2.4.x patch: trunk works:
      +1 covener, ylavic, jim
 
-   * event: avoid dereferencing a recently apr_pool_clear()'ed 
-     event_conn_state_t *cs when ptrans is being recycled at EOR.
-     trunk patch: http://svn.apache.org/r1638879
-                  http://svn.apache.org/r1640031
-     2.4.x patch: trunk works
-     +1 covener, ylavic, jim
-
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]

Modified: httpd/httpd/branches/2.4.x/server/mpm/event/event.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/server/mpm/event/event.c?rev=1642859&r1=1642858&r2=1642859&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/server/mpm/event/event.c (original)
+++ httpd/httpd/branches/2.4.x/server/mpm/event/event.c Tue Dec  2 12:49:42 2014
@@ -829,7 +829,6 @@ static int start_lingering_close_common(
         TO_QUEUE_REMOVE(*q, cs);
         apr_thread_mutex_unlock(timeout_mutex);
         apr_socket_close(cs->pfd.desc.s);
-        apr_pool_clear(cs->p);
         ap_push_pool(worker_queue_info, cs->p);
         return 0;
     }
@@ -847,7 +846,6 @@ static int start_lingering_close_common(
 static int start_lingering_close_blocking(event_conn_state_t *cs)
 {
     if (ap_start_lingering_close(cs->c)) {
-        apr_pool_clear(cs->p);
         ap_push_pool(worker_queue_info, cs->p);
         return 0;
     }
@@ -872,7 +870,6 @@ static int start_lingering_close_nonbloc
     if (c->aborted
         || apr_socket_shutdown(csd, APR_SHUTDOWN_WRITE) != APR_SUCCESS) {
         apr_socket_close(csd);
-        apr_pool_clear(cs->p);
         ap_push_pool(worker_queue_info, cs->p);
         return 0;
     }
@@ -896,7 +893,6 @@ static int stop_lingering_close(event_co
         ap_log_error(APLOG_MARK, APLOG_ERR, rv, ap_server_conf, APLOGNO(00468) "error closing socket");
         AP_DEBUG_ASSERT(0);
     }
-    apr_pool_clear(cs->p);
     ap_push_pool(worker_queue_info, cs->p);
     return 0;
 }
@@ -962,8 +958,6 @@ static void process_socket(apr_thread_t 
         c = ap_run_create_connection(p, ap_server_conf, sock,
                                      conn_id, sbh, cs->bucket_alloc);
         if (!c) {
-            apr_bucket_alloc_destroy(cs->bucket_alloc);
-            apr_pool_clear(p);
             ap_push_pool(worker_queue_info, p);
             return;
         }
@@ -1241,7 +1235,6 @@ static apr_status_t push2worker(const ap
         apr_socket_close(cs->pfd.desc.s);
         ap_log_error(APLOG_MARK, APLOG_CRIT, rc,
                      ap_server_conf, APLOGNO(00471) "push2worker: ap_queue_push failed");
-        apr_pool_clear(cs->p);
         ap_push_pool(worker_queue_info, cs->p);
     }
 
@@ -1378,7 +1371,6 @@ static void process_lingering_close(even
     apr_thread_mutex_unlock(timeout_mutex);
     TO_QUEUE_ELEM_INIT(cs);
 
-    apr_pool_clear(cs->p);
     ap_push_pool(worker_queue_info, cs->p);
 }
 
@@ -1699,7 +1691,6 @@ static void * APR_THREAD_FUNC listener_t
                             ap_log_error(APLOG_MARK, APLOG_CRIT, rc,
                                          ap_server_conf,
                                          "ap_queue_push failed");
-                            apr_pool_clear(ptrans);
                             ap_push_pool(worker_queue_info, ptrans);
                         }
                         else {
@@ -1707,7 +1698,6 @@ static void * APR_THREAD_FUNC listener_t
                         }
                     }
                     else {
-                        apr_pool_clear(ptrans);
                         ap_push_pool(worker_queue_info, ptrans);
                     }
                 }

Modified: httpd/httpd/branches/2.4.x/server/mpm/event/fdqueue.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/server/mpm/event/fdqueue.c?rev=1642859&r1=1642858&r2=1642859&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/server/mpm/event/fdqueue.c (original)
+++ httpd/httpd/branches/2.4.x/server/mpm/event/fdqueue.c Tue Dec  2 12:49:42 2014
@@ -231,6 +231,7 @@ void ap_push_pool(fd_queue_info_t * queu
         apr_atomic_inc32(&queue_info->recycled_pools_count);
     }
 
+    apr_pool_clear(pool_to_recycle);
     new_recycle = (struct recycled_pool *) apr_palloc(pool_to_recycle,
                                                       sizeof (*new_recycle));
     new_recycle->pool = pool_to_recycle;