mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
mod_proxy_balancer: Restore balancing after a failed worker has
recovered when using lbmethod_bybusyness. PR: 48735 Markus Stoll and Adam C both submitted patches against 2.2.x to bug 48735. Compared with those two, this solution 1. resets the busy field in the error-ed worker at the end of the request instead of at recovery time 2. leaves the lbstatus field alone 3. covers all possible scenarios where the busy field in the error-ed worker needs to be adjusted, since a cleanup to perform the decrement is registered at the point of the increment git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1366344 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -437,6 +437,17 @@ static void force_recovery(proxy_balancer *balancer, server_rec *s)
|
||||
}
|
||||
}
|
||||
|
||||
static apr_status_t decrement_busy_count(void *worker_)
|
||||
{
|
||||
proxy_worker *worker = worker_;
|
||||
|
||||
if (worker->s->busy) {
|
||||
worker->s->busy--;
|
||||
}
|
||||
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
static int proxy_balancer_pre_request(proxy_worker **worker,
|
||||
proxy_balancer **balancer,
|
||||
request_rec *r,
|
||||
@@ -570,6 +581,8 @@ static int proxy_balancer_pre_request(proxy_worker **worker,
|
||||
}
|
||||
|
||||
(*worker)->s->busy++;
|
||||
apr_pool_cleanup_register(r->pool, *worker, decrement_busy_count,
|
||||
apr_pool_cleanup_null);
|
||||
|
||||
/* Add balancer/worker info to env. */
|
||||
apr_table_setn(r->subprocess_env,
|
||||
@@ -642,11 +655,7 @@ static int proxy_balancer_post_request(proxy_worker *worker,
|
||||
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01176)
|
||||
"proxy_balancer_post_request for (%s)", balancer->s->name);
|
||||
|
||||
if (worker && worker->s->busy)
|
||||
worker->s->busy--;
|
||||
|
||||
return OK;
|
||||
|
||||
}
|
||||
|
||||
static void recalc_factors(proxy_balancer *balancer)
|
||||
|
Reference in New Issue
Block a user