You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2018/01/29 16:41:03 UTC
svn commit: r1822531 - /httpd/httpd/trunk/modules/proxy/proxy_util.c
Author: ylavic
Date: Mon Jan 29 16:41:03 2018
New Revision: 1822531
URL: http://svn.apache.org/viewvc?rev=1822531&view=rev
Log:
mod_proxy: fix proxy connection cleanup from an n+2 pool.
When connection_destructor() is called when pconf is gone, we can't dereference
worker->cp anymore. This happens is one_process mode exit if we apr_terminate()
or destroy the process pool directly (APR_POOL_DEBUG is needed too).
Fix this by NULL-ing worker->cp in conn_pool_cleanup(), and by registering it
as a pre_cleanup.
Modified:
httpd/httpd/trunk/modules/proxy/proxy_util.c
Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=1822531&r1=1822530&r2=1822531&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Mon Jan 29 16:41:03 2018
@@ -1306,10 +1306,7 @@ static void socket_cleanup(proxy_conn_re
static apr_status_t conn_pool_cleanup(void *theworker)
{
- proxy_worker *worker = (proxy_worker *)theworker;
- if (worker->cp->res) {
- worker->cp->pool = NULL;
- }
+ ((proxy_worker *)theworker)->cp = NULL;
return APR_SUCCESS;
}
@@ -1347,14 +1344,6 @@ static apr_status_t connection_cleanup(v
proxy_conn_rec *conn = (proxy_conn_rec *)theconn;
proxy_worker *worker = conn->worker;
- /*
- * If the connection pool is NULL the worker
- * cleanup has been run. Just return.
- */
- if (!worker->cp->pool) {
- return APR_SUCCESS;
- }
-
if (conn->r) {
apr_pool_destroy(conn->r->pool);
conn->r = NULL;
@@ -1476,7 +1465,7 @@ static apr_status_t connection_destructo
proxy_worker *worker = params;
/* Destroy the pool only if not called from reslist_destroy */
- if (worker->cp->pool) {
+ if (worker->cp) {
proxy_conn_rec *conn = resource;
apr_pool_destroy(conn->pool);
}
@@ -1907,9 +1896,8 @@ PROXY_DECLARE(apr_status_t) ap_proxy_ini
connection_constructor, connection_destructor,
worker, worker->cp->pool);
- apr_pool_cleanup_register(worker->cp->pool, (void *)worker,
- conn_pool_cleanup,
- apr_pool_cleanup_null);
+ apr_pool_pre_cleanup_register(worker->cp->pool, worker,
+ conn_pool_cleanup);
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00930)
"initialized pool in child %" APR_PID_T_FMT " for (%s) min=%d max=%d smax=%d",