mirror of
https://github.com/apache/httpd.git
synced 2025-08-07 04:02:58 +03:00
* Revert r1865944 and r1865938
Revert r1865944 and r1865938 in order to provide a better patch with less locking and thus contention. lognos PR63503: fix pool concurrency problems in mod_proxy reslist and resolver related calls could concurrently access the same pool. Submitted By: Don Poitras <Don.Poitras sas.com> Committed By: covener git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1868294 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -2053,34 +2053,22 @@ PROXY_DECLARE(apr_status_t) ap_proxy_initialize_worker(proxy_worker *worker, ser
|
|||||||
if (worker->tmutex == NULL) {
|
if (worker->tmutex == NULL) {
|
||||||
rv = apr_thread_mutex_create(&(worker->tmutex), APR_THREAD_MUTEX_DEFAULT, p);
|
rv = apr_thread_mutex_create(&(worker->tmutex), APR_THREAD_MUTEX_DEFAULT, p);
|
||||||
if (rv != APR_SUCCESS) {
|
if (rv != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, APLOGNO(00928)
|
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, APLOGNO(00928)
|
||||||
"can not create worker thread mutex");
|
"can not create worker thread mutex");
|
||||||
apr_global_mutex_unlock(proxy_mutex);
|
apr_global_mutex_unlock(proxy_mutex);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((rv = PROXY_THREAD_LOCK(worker)) != APR_SUCCESS) {
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, APLOGNO(10190) "lock");
|
|
||||||
apr_global_mutex_unlock(proxy_mutex);
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
if (worker->cp == NULL)
|
if (worker->cp == NULL)
|
||||||
init_conn_pool(p, worker);
|
init_conn_pool(p, worker);
|
||||||
if (worker->cp == NULL) {
|
if (worker->cp == NULL) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, APLOGNO(00929)
|
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, APLOGNO(00929)
|
||||||
"can not create connection pool");
|
"can not create connection pool");
|
||||||
if ((rv = PROXY_THREAD_UNLOCK(worker)) != APR_SUCCESS) {
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, APLOGNO(10191) "unlock");
|
|
||||||
}
|
|
||||||
apr_global_mutex_unlock(proxy_mutex);
|
apr_global_mutex_unlock(proxy_mutex);
|
||||||
return APR_EGENERAL;
|
return APR_EGENERAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rv = PROXY_THREAD_UNLOCK(worker)) != APR_SUCCESS) {
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, APLOGNO(10192) "unlock");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (worker->s->hmax) {
|
if (worker->s->hmax) {
|
||||||
rv = apr_reslist_create(&(worker->cp->res),
|
rv = apr_reslist_create(&(worker->cp->res),
|
||||||
worker->s->min, worker->s->smax,
|
worker->s->min, worker->s->smax,
|
||||||
@@ -2108,16 +2096,13 @@ PROXY_DECLARE(apr_status_t) ap_proxy_initialize_worker(proxy_worker *worker, ser
|
|||||||
rv = connection_constructor(&conn, worker, worker->cp->pool);
|
rv = connection_constructor(&conn, worker, worker->cp->pool);
|
||||||
worker->cp->conn = conn;
|
worker->cp->conn = conn;
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, s, APLOGNO(00931)
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00931)
|
||||||
"initialized single connection worker in child %" APR_PID_T_FMT " for (%s)",
|
"initialized single connection worker in child %" APR_PID_T_FMT " for (%s)",
|
||||||
getpid(), worker->s->hostname_ex);
|
getpid(), worker->s->hostname_ex);
|
||||||
}
|
}
|
||||||
if ((rv = PROXY_THREAD_UNLOCK(worker)) != APR_SUCCESS) {
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, APLOGNO(10193) "unlock");
|
|
||||||
}
|
|
||||||
apr_global_mutex_unlock(proxy_mutex);
|
apr_global_mutex_unlock(proxy_mutex);
|
||||||
|
|
||||||
} /* init worker */
|
}
|
||||||
if (rv == APR_SUCCESS) {
|
if (rv == APR_SUCCESS) {
|
||||||
worker->s->status |= (PROXY_WORKER_INITIALIZED);
|
worker->s->status |= (PROXY_WORKER_INITIALIZED);
|
||||||
worker->local_status |= (PROXY_WORKER_INITIALIZED);
|
worker->local_status |= (PROXY_WORKER_INITIALIZED);
|
||||||
@@ -2361,7 +2346,6 @@ PROXY_DECLARE(int) ap_proxy_acquire_connection(const char *proxy_function,
|
|||||||
server_rec *s)
|
server_rec *s)
|
||||||
{
|
{
|
||||||
apr_status_t rv;
|
apr_status_t rv;
|
||||||
apr_status_t err;
|
|
||||||
|
|
||||||
if (!PROXY_WORKER_IS_USABLE(worker)) {
|
if (!PROXY_WORKER_IS_USABLE(worker)) {
|
||||||
/* Retry the worker */
|
/* Retry the worker */
|
||||||
@@ -2376,26 +2360,18 @@ PROXY_DECLARE(int) ap_proxy_acquire_connection(const char *proxy_function,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (worker->s->hmax && worker->cp->res) {
|
if (worker->s->hmax && worker->cp->res) {
|
||||||
if ((err = PROXY_THREAD_LOCK(worker)) != APR_SUCCESS) {
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, err, s, APLOGNO(10194) "lock");
|
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
|
||||||
}
|
|
||||||
rv = apr_reslist_acquire(worker->cp->res, (void **)conn);
|
rv = apr_reslist_acquire(worker->cp->res, (void **)conn);
|
||||||
if ((err = PROXY_THREAD_UNLOCK(worker)) != APR_SUCCESS) {
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, err, s, APLOGNO(10195) "unlock");
|
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* create the new connection if the previous was destroyed */
|
/* create the new connection if the previous was destroyed */
|
||||||
if (!worker->cp->conn) {
|
if (!worker->cp->conn) {
|
||||||
rv = connection_constructor((void **)conn, worker, worker->cp->pool);
|
connection_constructor((void **)conn, worker, worker->cp->pool);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*conn = worker->cp->conn;
|
*conn = worker->cp->conn;
|
||||||
worker->cp->conn = NULL;
|
worker->cp->conn = NULL;
|
||||||
rv = APR_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
rv = APR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rv != APR_SUCCESS) {
|
if (rv != APR_SUCCESS) {
|
||||||
|
Reference in New Issue
Block a user