1
0
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:
Jeff Trawick
2012-07-27 11:50:25 +00:00
parent 8e0f68ea78
commit 94b3a2b552
2 changed files with 16 additions and 4 deletions

View File

@@ -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)