]> granicus.if.org Git - apache/commitdiff
Merge r1366344 from trunk:
authorJim Jagielski <jim@apache.org>
Sat, 28 Jul 2012 14:39:18 +0000 (14:39 +0000)
committerJim Jagielski <jim@apache.org>
Sat, 28 Jul 2012 14:39:18 +0000 (14:39 +0000)
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

Submitted by: trawick
Reviewed/backported by: jim

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1366691 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
modules/proxy/mod_proxy_balancer.c

diff --git a/CHANGES b/CHANGES
index 9ebcccd595c9e53ad9865b553d1286e375e3a731..81e0c757ac726d8d4847d92ceb702918a4f73846 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -7,6 +7,9 @@ Changes with Apache 2.4.3
      possible XSS for a site where untrusted users can upload files to
      a location with MultiViews enabled. [Niels Heinen <heinenn google.com>]
 
+  *) mod_proxy_balancer: Restore balancing after a failed worker has
+     recovered when using lbmethod_bybusyness.  PR 48735.  [Jeff Trawick]
+
   *) mod_setenvif: Compile some global regex only once during startup.
      This should save some memory, especially with .htaccess.
      [Stefan Fritsch]
diff --git a/STATUS b/STATUS
index 5b014e10c1c798c533cef1c418f00fa58956e437..3e6d7f287c4e4f623ce0b284dfaa3bdc652f1945 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -95,12 +95,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
      2.4.x patch: http://people.apache.org/~jorton/ap_proxyblock-24x-v2.diff [avoids major MMN bump]
      +1: jorton, rjung, jim
 
-   * mod_proxy_balancer: Restore balancing after a failed worker has
-     recovered when using lbmethod_bybusyness.  PR 48735.
-     trunk patch: http://svn.apache.org/viewvc?rev=1366344&view=rev
-     2.4.x patch: trunk patch works
-     +1: trawick, covener, jim
-
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]
 
index e3db4883f1f70bf4d831e4909d4708a8df9f63fb..26bb1a8856fdb2bc93236d3f72b398b92604e93a 100644 (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)