You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by rj...@apache.org on 2007/08/02 19:42:24 UTC
svn commit: r562194 - in /tomcat/connectors/trunk/jk:
native/common/jk_ajp13.h native/common/jk_ajp_common.c
native/common/jk_lb_worker.c xdocs/miscellaneous/changelog.xml
xdocs/reference/workers.xml
Author: rjung
Date: Thu Aug 2 10:42:23 2007
New Revision: 562194
URL: http://svn.apache.org/viewvc?view=rev&rev=562194
Log:
Make fail_on_status more useful in combination with an LB.
We can now optionally only fail over, without putting the
failed worker in an error state.
Modified:
tomcat/connectors/trunk/jk/native/common/jk_ajp13.h
tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c
tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml
tomcat/connectors/trunk/jk/xdocs/reference/workers.xml
Modified: tomcat/connectors/trunk/jk/native/common/jk_ajp13.h
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_ajp13.h?view=diff&rev=562194&r1=562193&r2=562194
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_ajp13.h (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_ajp13.h Thu Aug 2 10:42:23 2007
@@ -45,7 +45,8 @@
#define JK_CLIENT_RD_ERROR (-6)
#define JK_CLIENT_WR_ERROR (-7)
#define JK_STATUS_ERROR (-8)
-#define JK_REPLY_TIMEOUT (-9)
+#define JK_STATUS_FATAL_ERROR (-9)
+#define JK_REPLY_TIMEOUT (-10)
#define AJP13_MAX_SEND_BODY_SZ (DEF_BUFFER_SZ - 6)
#define AJP13_DEF_TIMEOUT (0) /* Idle timout for pooled connections */
Modified: tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c?view=diff&rev=562194&r1=562193&r2=562194
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c Thu Aug 2 10:42:23 2007
@@ -1427,9 +1427,12 @@
static int is_http_status_fail(ajp_worker_t *w, int status)
{
unsigned int i;
+ int soft_status = -1 * status;
for (i = 0; i < w->http_status_fail_num; i++) {
if (w->http_status_fail[i] == status)
return 1;
+ else if (w->http_status_fail[i] == soft_status)
+ return -1;
}
return 0;
}
@@ -1450,6 +1453,7 @@
switch (code) {
case JK_AJP13_SEND_HEADERS:
{
+ int rc;
jk_res_data_t res;
if (!ajp_unmarshal_response(msg, &res, ae, l)) {
jk_log(l, JK_LOG_ERROR,
@@ -1458,7 +1462,12 @@
return JK_AJP13_ERROR;
}
r->http_response_status = res.status;
- if (is_http_status_fail(ae->worker, res.status)) {
+ rc = is_http_status_fail(ae->worker, res.status);
+ if (rc > 0) {
+ JK_TRACE_EXIT(l);
+ return JK_STATUS_FATAL_ERROR;
+ }
+ else if (rc < 0) {
JK_TRACE_EXIT(l);
return JK_STATUS_ERROR;
}
@@ -1740,9 +1749,9 @@
else if (JK_AJP13_SEND_HEADERS == rc) {
headeratclient = JK_TRUE;
}
- else if (JK_STATUS_ERROR == rc) {
+ else if (JK_STATUS_ERROR == rc || JK_STATUS_FATAL_ERROR == rc) {
JK_TRACE_EXIT(l);
- return JK_STATUS_ERROR;
+ return rc;
}
else if (JK_AJP13_HAS_RESPONSE == rc) {
/*
@@ -2002,14 +2011,14 @@
JK_TRACE_EXIT(l);
return JK_SERVER_ERROR;
}
- else if (err == JK_STATUS_ERROR) {
+ else if (err == JK_STATUS_ERROR || err == JK_STATUS_FATAL_ERROR) {
jk_log(l, JK_LOG_INFO,
- "(%s) request failed, "
+ "(%s) request failed%s, "
"because of response status %d, "
"recoverable operation attempt=%d",
p->worker->name,
+ err == JK_STATUS_FATAL_ERROR ? "" : " (soft)",
s->http_response_status, i);
- JK_TRACE_EXIT(l);
if (i >= JK_RETRIES) {
jk_sleep(JK_SLEEP_DEF);
}
@@ -2089,6 +2098,11 @@
"(%s) Connecting to tomcat failed. Tomcat is probably not started "
"or is listening on the wrong port",
p->worker->name);
+
+ if (err == JK_STATUS_ERROR) {
+ JK_TRACE_EXIT(l);
+ return JK_STATUS_ERROR;
+ }
if (err == JK_REPLY_TIMEOUT) {
*is_error = JK_HTTP_GATEWAY_TIME_OUT;
Modified: tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c?view=diff&rev=562194&r1=562193&r2=562194
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c Thu Aug 2 10:42:23 2007
@@ -1113,8 +1113,9 @@
if (service_stat == JK_REPLY_TIMEOUT) {
rec->s->reply_timeouts++;
}
- if (service_stat != JK_REPLY_TIMEOUT ||
- rec->s->reply_timeouts > (unsigned)p->worker->s->max_reply_timeouts) {
+ if (service_stat != JK_STATUS_ERROR &&
+ (service_stat != JK_REPLY_TIMEOUT ||
+ rec->s->reply_timeouts > (unsigned)p->worker->s->max_reply_timeouts)) {
/*
* Service failed !!!
Modified: tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml?view=diff&rev=562194&r1=562193&r2=562194
==============================================================================
--- tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml Thu Aug 2 10:42:23 2007
@@ -28,6 +28,10 @@
<subsection name="Native">
<changelog>
<update>
+ General: fail_on_status used in a load balancer can optionally
+ do fail over without putting the failed worker in error state. (rjung)
+ </update>
+ <update>
NSAPI: Add initialization startup message containing JK version. (rjung)
</update>
<fix>
Modified: tomcat/connectors/trunk/jk/xdocs/reference/workers.xml
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/reference/workers.xml?view=diff&rev=562194&r1=562193&r2=562194
==============================================================================
--- tomcat/connectors/trunk/jk/xdocs/reference/workers.xml (original)
+++ tomcat/connectors/trunk/jk/xdocs/reference/workers.xml Thu Aug 2 10:42:23 2007
@@ -704,6 +704,14 @@
status codes separated by space or comma characters.
For example: <code>worker.xxx.fail_on_status=500,503</code>
</p>
+<p>
+Starting with <b>jk 1.2.25</b> you can also tell the load
+balancer to not put a member into an error state, if a
+response returned with one of the status codes in
+fail_on_status. This feature gets enabled, by putting a minus sign in
+front of those status codes.
+For example: <code>worker.xxx.fail_on_status=-404,-500,503</code>
+</p>
</directive>
<directive name="max_packet_size" workers="AJP,SUB" default="8192" required="false">
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r562194 - in /tomcat/connectors/trunk/jk: native/common/jk_ajp13.h native/common/jk_ajp_common.c native/common/jk_lb_worker.c xdocs/miscellaneous/changelog.xml xdocs/reference/workers.xml
Posted by Jim Jagielski <ji...@jaguNET.com>.
:)
It just seemed like a conscious coding style and didn't want
to confuse things...
Or else it was some normal C array/pointer confusion :)
*duck*
On Aug 8, 2007, at 12:09 PM, Rainer Jung wrote:
> You are missing nothing. Feel free to scratch :)
>
> Regards,
>
> Rainer
>
> Jim Jagielski wrote:
>> On Aug 2, 2007, at 4:29 PM, Rainer Jung wrote:
>>> And in fact it doesn't matter. I found it more logical, to have
>>> JK_STATUS_ERROR and JK_STATUS_FATAL_ERROR closer together (for
>>> those reading the code). The constants are not used outside JK,
>>> so there is no compatibility problem.
>>>
>>> It looks like your are closely following todays JK changes. I
>>> really appreciate that! Unless you find problems, I just now
>>> commited my last change (hopefully) for 1.2.25.
>> A other little nit: The see a few places where
>> we have things like (in jk_lb_worker.c for example):
>> &(p->lb_workers[0].s->route[0])
>> Can't they simply be reduced to
>> p->lb_workers[0].s->route
>> ?
>> Not exactly sure what I'm missing there...
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r562194 - in /tomcat/connectors/trunk/jk: native/common/jk_ajp13.h
native/common/jk_ajp_common.c native/common/jk_lb_worker.c xdocs/miscellaneous/changelog.xml
xdocs/reference/workers.xml
Posted by Rainer Jung <ra...@kippdata.de>.
You are missing nothing. Feel free to scratch :)
Regards,
Rainer
Jim Jagielski wrote:
>
> On Aug 2, 2007, at 4:29 PM, Rainer Jung wrote:
>
>> And in fact it doesn't matter. I found it more logical, to have
>> JK_STATUS_ERROR and JK_STATUS_FATAL_ERROR closer together (for those
>> reading the code). The constants are not used outside JK, so there is
>> no compatibility problem.
>>
>> It looks like your are closely following todays JK changes. I really
>> appreciate that! Unless you find problems, I just now commited my last
>> change (hopefully) for 1.2.25.
>
> A other little nit: The see a few places where
> we have things like (in jk_lb_worker.c for example):
>
> &(p->lb_workers[0].s->route[0])
>
> Can't they simply be reduced to
>
> p->lb_workers[0].s->route
>
> ?
>
> Not exactly sure what I'm missing there...
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r562194 - in /tomcat/connectors/trunk/jk: native/common/jk_ajp13.h native/common/jk_ajp_common.c native/common/jk_lb_worker.c xdocs/miscellaneous/changelog.xml xdocs/reference/workers.xml
Posted by Jim Jagielski <ji...@jaguNET.com>.
On Aug 2, 2007, at 4:29 PM, Rainer Jung wrote:
> And in fact it doesn't matter. I found it more logical, to have
> JK_STATUS_ERROR and JK_STATUS_FATAL_ERROR closer together (for
> those reading the code). The constants are not used outside JK, so
> there is no compatibility problem.
>
> It looks like your are closely following todays JK changes. I
> really appreciate that! Unless you find problems, I just now
> commited my last change (hopefully) for 1.2.25.
A other little nit: The see a few places where
we have things like (in jk_lb_worker.c for example):
&(p->lb_workers[0].s->route[0])
Can't they simply be reduced to
p->lb_workers[0].s->route
?
Not exactly sure what I'm missing there...
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r562194 - in /tomcat/connectors/trunk/jk: native/common/jk_ajp13.h
native/common/jk_ajp_common.c native/common/jk_lb_worker.c xdocs/miscellaneous/changelog.xml
xdocs/reference/workers.xml
Posted by Rainer Jung <ra...@kippdata.de>.
And in fact it doesn't matter. I found it more logical, to have
JK_STATUS_ERROR and JK_STATUS_FATAL_ERROR closer together (for those
reading the code). The constants are not used outside JK, so there is no
compatibility problem.
It looks like your are closely following todays JK changes. I really
appreciate that! Unless you find problems, I just now commited my last
change (hopefully) for 1.2.25.
Regards,
Rainer
Jim Jagielski wrote:
>
> On Aug 2, 2007, at 1:42 PM, rjung@apache.org wrote:
>
>> ==============================================================================
>>
>> --- tomcat/connectors/trunk/jk/native/common/jk_ajp13.h (original)
>> +++ tomcat/connectors/trunk/jk/native/common/jk_ajp13.h Thu Aug 2
>> 10:42:23 2007
>> @@ -45,7 +45,8 @@
>> #define JK_CLIENT_RD_ERROR (-6)
>> #define JK_CLIENT_WR_ERROR (-7)
>> #define JK_STATUS_ERROR (-8)
>> -#define JK_REPLY_TIMEOUT (-9)
>> +#define JK_STATUS_FATAL_ERROR (-9)
>> +#define JK_REPLY_TIMEOUT (-10)
>>
>
> I'm curious... One reason to use C #defines is to abstract
> out the macro and their values. So why, when adding
> entries to we force JK_REPLY_TIMEOUT to always be
> the lowest value? It shouldn't matter what the
> "real" values are, right? This is especially true if we
> ever want to leak these out externally :)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r562194 - in /tomcat/connectors/trunk/jk: native/common/jk_ajp13.h native/common/jk_ajp_common.c native/common/jk_lb_worker.c xdocs/miscellaneous/changelog.xml xdocs/reference/workers.xml
Posted by Jim Jagielski <ji...@jaguNET.com>.
On Aug 2, 2007, at 1:42 PM, rjung@apache.org wrote:
> ======================================================================
> ========
> --- tomcat/connectors/trunk/jk/native/common/jk_ajp13.h (original)
> +++ tomcat/connectors/trunk/jk/native/common/jk_ajp13.h Thu Aug 2
> 10:42:23 2007
> @@ -45,7 +45,8 @@
> #define JK_CLIENT_RD_ERROR (-6)
> #define JK_CLIENT_WR_ERROR (-7)
> #define JK_STATUS_ERROR (-8)
> -#define JK_REPLY_TIMEOUT (-9)
> +#define JK_STATUS_FATAL_ERROR (-9)
> +#define JK_REPLY_TIMEOUT (-10)
>
I'm curious... One reason to use C #defines is to abstract
out the macro and their values. So why, when adding
entries to we force JK_REPLY_TIMEOUT to always be
the lowest value? It shouldn't matter what the
"real" values are, right? This is especially true if we
ever want to leak these out externally :)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org