On 7/16/2010 10:37 AM, Jeff Trawick wrote:
On Fri, Jul 16, 2010 at 11:27 AM, William A. Rowe Jr.
<wr...@rowe-clan.net> wrote:
On 7/16/2010 9:35 AM, William A. Rowe Jr. wrote:
On 7/16/2010 6:47 AM, Jeff Trawick wrote:
We may as well leave it at "erroronstatus" I agree with Eric on
keeping your original choice and worrying about the doc.
Can we drop the word error, since it has four potential meanings?
backendfailureonstatus perhaps, or something along those lines?
Hold up; see http://tomcat.apache.org/connectors-doc/reference/workers.html
fail_on_status - why would we invent new phrases?
good catch
Sounds like this would be the best name. As promised, here is the final
patch including doc, the name "failonstatus", and updates made in trunk
for this patch. Also included is an update to trunk for the new name and
doc.
For ease of reading, the doc patch reads thusly:
A single or comma-separated list of HTTP status codes. If set
this will
force the worker into error state when the backend returns any
status code
in the list. Worker recovery behaves the same as other worker
errors.
Finally, here is my proposed change to STATUS to indicate completion of
Jeff's suggestions as well as update the location of the 2.2.x patch:
--- STATUS 2010-07-20 09:53:36.298789200 -0500
+++ STATUS.mod 2010-07-20 09:54:15.466286400 -0500
@@ -145,13 +145,9 @@
statuses are found
PR: 48939
Trunk patch: http://svn.apache.org/viewvc?rev=930125&view=rev
- 2.2.x patch: https://issues.apache.org/bugzilla/attachment.cgi?id=25153
+ 2.2.x patch: https://issues.apache.org/bugzilla/attachment.cgi?id=25788
Submitted by: Daniel Ruggeri <DRuggeri primary.net>
+1: niq, jim
- trawick suggests:
- 1. somebody write doc (Daniel volunteers)
- 2. somebody create new patch which includes r962972, any
- subsequent changes, and doc (Daniel volunteers)
* mod_disk_cache: Decline the opportunity to cache if the response is
a 206 Partial Content. This stops a reverse proxied partial response
Thank you, all.
--
Daniel Ruggeri
Index: httpd-2.2.x/docs/manual/mod/mod_proxy.xml
===================================================================
--- httpd-2.2.x/docs/manual/mod/mod_proxy.xml (revision 965843)
+++ httpd-2.2.x/docs/manual/mod/mod_proxy.xml (working copy)
@@ -859,6 +859,12 @@
<td>Balancer timeout in seconds. If set this will be the maximum time
to wait for a free worker. Default is not to wait.
</td></tr>
+ <tr><td>failonstatus</td>
+ <td>-</td>
+ <td>A single or comma-separated list of HTTP status codes. If set this
will
+ force the worker into error state when the backend returns any status
code
+ in the list. Worker recovery behaves the same as other worker errors.
+ </td></tr>
</table>
<p>A sample balancer setup</p>
Index: httpd-2.2.x/modules/proxy/mod_proxy_balancer.c
===================================================================
--- httpd-2.2.x/modules/proxy/mod_proxy_balancer.c (revision 965843)
+++ httpd-2.2.x/modules/proxy/mod_proxy_balancer.c (working copy)
@@ -591,7 +591,6 @@
proxy_server_conf *conf)
{
-#if 0
apr_status_t rv;
if ((rv = PROXY_THREAD_LOCK(balancer)) != APR_SUCCESS) {
@@ -600,8 +599,20 @@
balancer->name);
return HTTP_INTERNAL_SERVER_ERROR;
}
- /* TODO: placeholder for post_request actions
- */
+ if (!apr_is_empty_array(balancer->errstatuses)) {
+ int i;
+ for (i = 0; i < balancer->errstatuses->nelts; i++) {
+ int val = ((int *)balancer->errstatuses->elts)[i];
+ if (r->status == val) {
+ ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
+ "proxy: BALANCER: (%s). Forcing recovery for
worker (%s), failonstatus %d",
+ balancer->name, worker->name, val);
+ worker->s->status |= PROXY_WORKER_IN_ERROR;
+ worker->s->error_time = apr_time_now();
+ break;
+ }
+ }
+ }
if ((rv = PROXY_THREAD_UNLOCK(balancer)) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
@@ -611,8 +622,6 @@
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"proxy_balancer_post_request for (%s)", balancer->name);
-#endif
-
if (worker && worker->s->busy)
worker->s->busy--;
Index: httpd-2.2.x/modules/proxy/mod_proxy.c
===================================================================
--- httpd-2.2.x/modules/proxy/mod_proxy.c (revision 965843)
+++ httpd-2.2.x/modules/proxy/mod_proxy.c (working copy)
@@ -365,6 +365,28 @@
else
return "scolonpathdelim must be On|Off";
}
+ else if (!strcasecmp(key, "erroronstatus")) {
+ char *val_split;
+ char *status;
+ char *tok_state;
+
+ val_split = apr_pstrdup(p, val);
+
+ balancer->errstatuses = apr_array_make(p, 1, sizeof(int));
+
+ status = apr_strtok(val_split, ", ", &tok_state);
+ while (status != NULL) {
+ ival = atoi(status);
+ if (ap_is_HTTP_VALID_RESPONSE(ival)) {
+ *(int *)apr_array_push(balancer->errstatuses) = ival;
+ }
+ else {
+ return "erroronstatus must be one or more HTTP response code";
+ }
+ status = apr_strtok(NULL, ", ", &tok_state);
+ }
+
+ }
else {
return "unknown Balancer parameter";
}
Index: httpd-2.2.x/modules/proxy/mod_proxy.h
===================================================================
--- httpd-2.2.x/modules/proxy/mod_proxy.h (revision 965843)
+++ httpd-2.2.x/modules/proxy/mod_proxy.h (working copy)
@@ -375,6 +375,7 @@
int max_attempts; /* Number of attempts before failing */
char max_attempts_set;
proxy_balancer_method *lbmethod;
+ apr_array_header_t *errstatuses; /* statuses to force members into error */
/* XXX: Perhaps we will need the proc mutex too.
* Altrough we are only using arithmetic operations
Index: httpd-trunk/docs/manual/mod/mod_proxy.xml
===================================================================
--- httpd-trunk/docs/manual/mod/mod_proxy.xml (revision 965850)
+++ httpd-trunk/docs/manual/mod/mod_proxy.xml (working copy)
@@ -861,6 +861,12 @@
<td>Balancer timeout in seconds. If set this will be the maximum time
to wait for a free worker. Default is not to wait.
</td></tr>
+ <tr><td>failonstatus</td>
+ <td>-</td>
+ <td>A single or comma-separated list of HTTP status codes. If set this
will
+ force the worker into error state when the backend returns any status
code
+ in the list. Worker recovery behaves the same as other worker errors.
+ </td></tr>
</table>
<p>A sample balancer setup</p>
Index: httpd-trunk/modules/proxy/mod_proxy_balancer.c
===================================================================
--- httpd-trunk/modules/proxy/mod_proxy_balancer.c (revision 965850)
+++ httpd-trunk/modules/proxy/mod_proxy_balancer.c (working copy)
@@ -618,7 +618,7 @@
int val = ((int *)balancer->errstatuses->elts)[i];
if (r->status == val) {
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
- "proxy: BALANCER: (%s). Forcing recovery for
worker (%s), erroronstatus %d",
+ "proxy: BALANCER: (%s). Forcing recovery for
worker (%s), failonstatus %d",
balancer->name, worker->name, val);
worker->s->status |= PROXY_WORKER_IN_ERROR;
worker->s->error_time = apr_time_now();
Index: httpd-trunk/modules/proxy/mod_proxy.c
===================================================================
--- httpd-trunk/modules/proxy/mod_proxy.c (revision 965850)
+++ httpd-trunk/modules/proxy/mod_proxy.c (working copy)
@@ -381,7 +381,7 @@
else
return "scolonpathdelim must be On|Off";
}
- else if (!strcasecmp(key, "erroronstatus")) {
+ else if (!strcasecmp(key, "failonstatus")) {
char *val_split;
char *status;
char *tok_state;
@@ -397,7 +397,7 @@
*(int *)apr_array_push(balancer->errstatuses) = ival;
}
else {
- return "erroronstatus must be one or more HTTP response code";
+ return "failonstatus must be one or more HTTP response code";
}
status = apr_strtok(NULL, ", ", &tok_state);
}