httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yla...@apache.org
Subject svn commit: r1640031 - in /httpd/httpd/trunk/server/mpm: event/event.c event/fdqueue.c eventopt/eventopt.c eventopt/fdqueue.c
Date Sun, 16 Nov 2014 21:32:48 GMT
Author: ylavic
Date: Sun Nov 16 21:32:48 2014
New Revision: 1640031

URL: http://svn.apache.org/r1640031
Log:
event, eventopt: follow up to r1638879 and r1639960.
Clear the pool in ap_push_pool() before recycling.

Modified:
    httpd/httpd/trunk/server/mpm/event/event.c
    httpd/httpd/trunk/server/mpm/event/fdqueue.c
    httpd/httpd/trunk/server/mpm/eventopt/eventopt.c
    httpd/httpd/trunk/server/mpm/eventopt/fdqueue.c

Modified: httpd/httpd/trunk/server/mpm/event/event.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/event/event.c?rev=1640031&r1=1640030&r2=1640031&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/event/event.c (original)
+++ httpd/httpd/trunk/server/mpm/event/event.c Sun Nov 16 21:32:48 2014
@@ -867,15 +867,13 @@ static int start_lingering_close_common(
     rv = apr_pollset_add(event_pollset, &cs->pfd);
     apr_thread_mutex_unlock(timeout_mutex);
     if (rv != APR_SUCCESS && !APR_STATUS_IS_EEXIST(rv)) {
-        apr_pool_t *p = cs->p;
         ap_log_error(APLOG_MARK, APLOG_ERR, rv, ap_server_conf,
                      "start_lingering_close: apr_pollset_add failure");
         apr_thread_mutex_lock(timeout_mutex);
         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, p);
+        ap_push_pool(worker_queue_info, cs->p);
         return 0;
     }
     return 1;
@@ -892,9 +890,7 @@ 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_t *p = cs->p;
-        apr_pool_clear(cs->p);
-        ap_push_pool(worker_queue_info, p);
+        ap_push_pool(worker_queue_info, cs->p);
         return 0;
     }
     return start_lingering_close_common(cs, 1);
@@ -919,7 +915,6 @@ static int start_lingering_close_nonbloc
         || ap_shutdown_conn(c, 0) != APR_SUCCESS || 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;
     }
@@ -936,7 +931,6 @@ static int stop_lingering_close(event_co
 {
     apr_status_t rv;
     apr_socket_t *csd = ap_get_conn_socket(cs->c);
-    apr_pool_t *p = cs->p;
     ap_log_error(APLOG_MARK, APLOG_TRACE4, 0, ap_server_conf,
                  "socket reached timeout in lingering-close state");
     rv = apr_socket_close(csd);
@@ -944,8 +938,7 @@ 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, p);
+    ap_push_pool(worker_queue_info, cs->p);
     return 0;
 }
 
@@ -1010,8 +1003,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;
         }
@@ -1355,7 +1346,6 @@ static apr_status_t push2worker(const ap
 
     rc = ap_queue_push(worker_queue, cs->pfd.desc.s, cs, cs->p);
     if (rc != APR_SUCCESS) {
-        apr_pool_t *p = cs->p;
         /* trash the connection; we couldn't queue the connected
          * socket to a worker
          */
@@ -1363,8 +1353,7 @@ 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, p);
+        ap_push_pool(worker_queue_info, cs->p);
     }
 
     return rc;
@@ -1585,7 +1574,6 @@ static void process_lingering_close(even
     apr_size_t nbytes;
     apr_status_t rv;
     struct timeout_queue *q;
-    apr_pool_t *p = cs->p;
     q = (cs->pub.state == CONN_STATE_LINGER_SHORT) ?  &short_linger_q : &linger_q;
 
     /* socket is already in non-blocking state */
@@ -1609,8 +1597,7 @@ 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, p);
+    ap_push_pool(worker_queue_info, cs->p);
 }
 
 /* call 'func' for all elements of 'q' with timeout less than 'timeout_time'.
@@ -1942,7 +1929,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 {
@@ -1950,7 +1936,6 @@ static void * APR_THREAD_FUNC listener_t
                         }
                     }
                     else {
-                        apr_pool_clear(ptrans);
                         ap_push_pool(worker_queue_info, ptrans);
                     }
                 }

Modified: httpd/httpd/trunk/server/mpm/event/fdqueue.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/event/fdqueue.c?rev=1640031&r1=1640030&r2=1640031&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/event/fdqueue.c (original)
+++ httpd/httpd/trunk/server/mpm/event/fdqueue.c Sun Nov 16 21:32:48 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;

Modified: httpd/httpd/trunk/server/mpm/eventopt/eventopt.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/eventopt/eventopt.c?rev=1640031&r1=1640030&r2=1640031&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/eventopt/eventopt.c (original)
+++ httpd/httpd/trunk/server/mpm/eventopt/eventopt.c Sun Nov 16 21:32:48 2014
@@ -820,12 +820,10 @@ static int process_pollop(pollset_op_t *
     rv = apr_pollset_add(event_pollset, &op->cs->pfd);
 
     if (rv != APR_SUCCESS && !APR_STATUS_IS_EEXIST(rv)) {
-        apr_pool_t *p = cs->p;
         ap_log_error(APLOG_MARK, APLOG_ERR, rv, ap_server_conf, APLOGNO(00467)
                      "%s: apr_pollset_add failure", op->tag);
         apr_socket_close(cs->pfd.desc.s);
-        apr_pool_clear(cs->p);
-        ap_push_pool(worker_queue_info, p);
+        ap_push_pool(worker_queue_info, cs->p);
         return 0;
     }
     return 1;
@@ -911,9 +909,7 @@ static int start_lingering_close(event_c
 static int start_lingering_close_blocking(event_conn_state_t *cs, ap_equeue_t *eq)
 {
     if (ap_start_lingering_close(cs->c)) {
-        apr_pool_t *p = cs->p;
-        apr_pool_clear(cs->p);
-        ap_push_pool(worker_queue_info, p);
+        ap_push_pool(worker_queue_info, cs->p);
         return 0;
     }
     return start_lingering_close(cs, eq);
@@ -937,10 +933,8 @@ static int start_lingering_close_nonbloc
     if (c->aborted
         || ap_shutdown_conn(c, 0) != APR_SUCCESS || c->aborted
         || apr_socket_shutdown(csd, APR_SHUTDOWN_WRITE) != APR_SUCCESS) {
-        apr_pool_t *p = cs->p;
         apr_socket_close(csd);
-        apr_pool_clear(cs->p);
-        ap_push_pool(worker_queue_info, p);
+        ap_push_pool(worker_queue_info, cs->p);
         return 0;
     }
     return start_lingering_close(cs, eq);
@@ -956,7 +950,6 @@ static int stop_lingering_close(event_co
 {
     apr_status_t rv;
     apr_socket_t *csd = ap_get_conn_socket(cs->c);
-    apr_pool_t *p = cs->p;
     ap_log_error(APLOG_MARK, APLOG_TRACE4, 0, ap_server_conf,
                  "socket reached timeout in lingering-close state");
     rv = apr_socket_close(csd);
@@ -964,8 +957,7 @@ 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, p);
+    ap_push_pool(worker_queue_info, cs->p);
     return 0;
 }
 
@@ -992,8 +984,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;
         }
@@ -1315,7 +1305,6 @@ static apr_status_t push2worker(const ap
 
     rc = ap_queue_push(worker_queue, cs->pfd.desc.s, cs, cs->p);
     if (rc != APR_SUCCESS) {
-        apr_pool_t *p = cs->p;
         /* trash the connection; we couldn't queue the connected
          * socket to a worker
          */
@@ -1323,8 +1312,7 @@ 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, p);
+        ap_push_pool(worker_queue_info, cs->p);
     }
 
     return rc;
@@ -1436,7 +1424,6 @@ static void process_lingering_close(even
     apr_size_t nbytes;
     apr_status_t rv;
     struct timeout_queue *q;
-    apr_pool_t *p = cs->p;
     q = (cs->pub.state == CONN_STATE_LINGER_SHORT) ?  &short_linger_q : &linger_q;
 
     /* socket is already in non-blocking state */
@@ -1458,8 +1445,7 @@ static void process_lingering_close(even
     TO_QUEUE_REMOVE(*q, cs);
     TO_QUEUE_ELEM_INIT(cs);
 
-    apr_pool_clear(cs->p);
-    ap_push_pool(worker_queue_info, p);
+    ap_push_pool(worker_queue_info, cs->p);
 }
 
 /* call 'func' for all elements of 'q' with timeout less than 'timeout_time'.
@@ -1773,7 +1759,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 {
@@ -1781,7 +1766,6 @@ static void * APR_THREAD_FUNC listener_t
                         }
                     }
                     else {
-                        apr_pool_clear(ptrans);
                         ap_push_pool(worker_queue_info, ptrans);
                     }
                 }

Modified: httpd/httpd/trunk/server/mpm/eventopt/fdqueue.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/eventopt/fdqueue.c?rev=1640031&r1=1640030&r2=1640031&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/eventopt/fdqueue.c (original)
+++ httpd/httpd/trunk/server/mpm/eventopt/fdqueue.c Sun Nov 16 21:32:48 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;



Mime
View raw message