httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject svn commit: r1366344 - in /httpd/httpd/trunk: CHANGES modules/proxy/mod_proxy_balancer.c
Date Fri, 27 Jul 2012 11:50:25 GMT
Author: trawick
Date: Fri Jul 27 11:50:25 2012
New Revision: 1366344

URL: http://svn.apache.org/viewvc?rev=1366344&view=rev
Log:
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

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1366344&r1=1366343&r2=1366344&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Fri Jul 27 11:50:25 2012
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mod_proxy_balancer: Restore balancing after a failed worker has
+     recovered when using lbmethod_bybusyness.  PR 48735.  [Jeff Trawick]
+
   *) mod_proxy: Fix memory leak or possible corruption in ProxyBlock
      implementation.  [Ruediger Pluem, Joe Orton]
 

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c?rev=1366344&r1=1366343&r2=1366344&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c Fri Jul 27 11:50:25 2012
@@ -437,6 +437,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,
@@ -570,6 +581,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,
@@ -642,11 +655,7 @@ static int proxy_balancer_post_request(p
     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)



Mime
View raw message