You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2012/08/15 13:52:42 UTC

svn commit: r1373355 - in /httpd/httpd/branches/2.2.x: ./ CHANGES STATUS modules/proxy/mod_proxy_balancer.c

Author: trawick
Date: Wed Aug 15 11:52:42 2012
New Revision: 1373355

URL: http://svn.apache.org/viewvc?rev=1373355&view=rev
Log:
Merge r136634 from trunk:

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 by: druggeri, rpluem

Modified:
    httpd/httpd/branches/2.2.x/   (props changed)
    httpd/httpd/branches/2.2.x/CHANGES
    httpd/httpd/branches/2.2.x/STATUS
    httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_balancer.c

Propchange: httpd/httpd/branches/2.2.x/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk:r1366344

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?rev=1373355&r1=1373354&r2=1373355&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Wed Aug 15 11:52:42 2012
@@ -5,6 +5,9 @@ Changes with Apache 2.2.23
      envvars: Fix insecure handling of LD_LIBRARY_PATH that could lead to the
      current working directory to be searched for DSOs. [Stefan Fritsch]
 
+  *) mod_proxy_balancer: Restore balancing after a failed worker has
+     recovered when using lbmethod_bybusyness.  PR 48735.  [Jeff Trawick]
+
   *) mod_dumpio: Properly handle errors from subsequent input filters.
      PR 52914. [Stefan Fritsch]
 

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=1373355&r1=1373354&r2=1373355&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Wed Aug 15 11:52:42 2012
@@ -112,12 +112,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
     2.2.x patch: http://people.apache.org/~jim/patches/mod_proxy_ajp-erroroverride.patch
     +1: igalic, jim, rpluem
 
-   * mod_proxy_balancer: Restore balancing after a failed worker has
-     recovered when using lbmethod_bybusyness.  PR 48735.
-     trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1366344
-     2.2.x patch: trunk patch works
-     +1: trawick, druggeri, rpluem
-
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]
 

Modified: httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_balancer.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_balancer.c?rev=1373355&r1=1373354&r2=1373355&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_balancer.c (original)
+++ httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_balancer.c Wed Aug 15 11:52:42 2012
@@ -431,6 +431,17 @@ static void force_recovery(proxy_balance
     }
 }
 
+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,
@@ -552,6 +563,8 @@ static int proxy_balancer_pre_request(pr
     }
 
     (*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,
@@ -622,11 +635,7 @@ static int proxy_balancer_post_request(p
     ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                  "proxy_balancer_post_request for (%s)", balancer->name);
 
-    if (worker && worker->s->busy)
-        worker->s->busy--;
-
     return OK;
-
 }
 
 static void recalc_factors(proxy_balancer *balancer)