ASF Bugzilla – Attachment 23519 Details for
Bug 46215
Race condition in bybusyness algorithm
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch using apr_atomic functions, also adding "busyness" column in balancer-manager
mod_proxy_balancer-atomic_busyness.patch (text/plain), 3.47 KB, created by
Thomas Binder
on 2009-04-21 06:20:17 UTC
(
hide
)
Description:
Patch using apr_atomic functions, also adding "busyness" column in balancer-manager
Filename:
MIME Type:
Creator:
Thomas Binder
Created:
2009-04-21 06:20:17 UTC
Size:
3.47 KB
patch
obsolete
>diff -ur httpd-2.2.11.orig/modules/proxy/mod_proxy.h httpd-2.2.11/modules/proxy/mod_proxy.h >--- httpd-2.2.11.orig/modules/proxy/mod_proxy.h 2008-11-11 21:04:34.000000000 +0100 >+++ httpd-2.2.11/modules/proxy/mod_proxy.h 2009-04-20 16:52:52.000000000 +0200 >@@ -304,7 +304,7 @@ > char route[PROXY_WORKER_MAX_ROUTE_SIZ+1]; > char redirect[PROXY_WORKER_MAX_ROUTE_SIZ+1]; > void *context; /* general purpose storage */ >- apr_size_t busy; /* busyness factor */ >+ apr_uint32_t busy; /* busyness factor */ > int lbset; /* load balancer cluster set */ > } proxy_worker_stat; > >diff -ur httpd-2.2.11.orig/modules/proxy/mod_proxy_balancer.c httpd-2.2.11/modules/proxy/mod_proxy_balancer.c >--- httpd-2.2.11.orig/modules/proxy/mod_proxy_balancer.c 2008-11-15 15:16:23.000000000 +0100 >+++ httpd-2.2.11/modules/proxy/mod_proxy_balancer.c 2009-04-21 15:10:06.000000000 +0200 >@@ -24,6 +24,7 @@ > #include "apr_version.h" > #include "apr_hooks.h" > #include "apr_uuid.h" >+#include "apr_atomic.h" > > module AP_MODULE_DECLARE_DATA proxy_balancer_module; > >@@ -543,7 +544,7 @@ > *worker = runtime; > } > >- (*worker)->s->busy++; >+ apr_atomic_inc32(&((*worker)->s->busy)); > > /* Add balancer/worker info to env. */ > apr_table_setn(r->subprocess_env, >@@ -605,8 +606,8 @@ > > #endif > >- if (worker && worker->s->busy) >- worker->s->busy--; >+ if (worker && apr_atomic_read32(&(worker->s->busy))) >+ apr_atomic_dec32(&(worker->s->busy)); > > return OK; > >@@ -830,6 +831,7 @@ > "<th>Worker URL</th>" > "<th>Route</th><th>RouteRedir</th>" > "<th>Factor</th><th>Set</th><th>Status</th>" >+ "<th>Busyness</th>" > "<th>Elected</th><th>To</th><th>From</th>" > "</tr>\n", r); > >@@ -861,6 +863,7 @@ > if (!PROXY_WORKER_IS_INITIALIZED(worker)) > ap_rputs("-", r); > ap_rputs("</td>", r); >+ ap_rprintf(r, "<td>%" APR_SIZE_T_FMT "</td>", (apr_size_t)worker->s->busy); > ap_rprintf(r, "<td>%" APR_SIZE_T_FMT "</td><td>", worker->s->elected); > ap_rputs(apr_strfsize(worker->s->transferred, fbuf), r); > ap_rputs("</td><td>", r); >@@ -1037,7 +1040,7 @@ > mycandidate->s->lbstatus -= total_factor; > ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, > "proxy: byrequests selected worker \"%s\" : busy %" APR_SIZE_T_FMT " : lbstatus %d", >- mycandidate->name, mycandidate->s->busy, mycandidate->s->lbstatus); >+ mycandidate->name, (apr_size_t)mycandidate->s->busy, mycandidate->s->lbstatus); > > } > >@@ -1120,7 +1123,7 @@ > if (mycandidate) { > ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, > "proxy: bytraffic selected worker \"%s\" : busy %" APR_SIZE_T_FMT, >- mycandidate->name, mycandidate->s->busy); >+ mycandidate->name, (apr_size_t)mycandidate->s->busy); > > } > >@@ -1202,7 +1205,7 @@ > mycandidate->s->lbstatus -= total_factor; > ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, > "proxy: bybusyness selected worker \"%s\" : busy %" APR_SIZE_T_FMT " : lbstatus %d", >- mycandidate->name, mycandidate->s->busy, mycandidate->s->lbstatus); >+ mycandidate->name, (apr_size_t)mycandidate->s->busy, mycandidate->s->lbstatus); > > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 46215
:
22876
| 23519