You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Alexander Schwartz <al...@gmx.net> on 2004/01/26 22:04:58 UTC

failover-problem and session mixup: jakarta-tomcat-connectors: jk_ajp_common.c

Hello Tomcat-Developers,

we are currently experiencing some problems with mod_jk with
loadbalancing: 

   (A) when a post-request fails while receiving data from tomcat, the
loadbalancer tries to send the request to the other tomcat, but
"forgets" the post body content (i.e. login and password submitted by
the user). The size of the body content is only a few bytes (< 100), so
it's not the "known" problem with bodies longer than 8k. 

   (B) it seems that sometimes after a POST-failover body data from an
old request is sent to the other tomcat when the first connection
failed. This leads to a session mix-up & user mix-up!

The setup is a simple cluster configuration: one apache httpd with
mod_ssl in front, mod_jk with one configured loadbalance worker with
sticky sessions and two child ajp13 workers in the middle, two tomcats
in the back. 

Versions involved: mod_jk 1.2.4, Tomcat 4.1.27 (but also tested with
mod_jk 1.2.5 and Tomcat 4.1.29). Apache on AIX, version 1.3.29. The
latest version of jk_ajp_common.c in CVS don't seem to have relevant
changes. We have searched the mailinglists, the only source I have found
is in tomcat-user-mailinglist where Jean-Philippe Belanger describes a
similar problem in the mails from 14 Jan 2004 (the empty POST body) and
12 Jan 2004 (the empty POST body and the session mixup). He didn't
investigate further but got himself a cisco load balancer. Another post
is here, but I found no replies/solutions.

http://www.mail-archive.com/tomcat-dev@jakarta.apache.org/msg48833.html

(A) can be reproduced quite easily using "netcat" as a simulator of the
first tomcat and a second real tomcat. If you kill netcat after it has
accepted a POST-connection from a mod_jk, mod_jk will forward the
request to the other tomcat without the POST-body 

But we can't reproduce (B), but it has definitely happened. We suspect
that POST-Recovery code might send an old request body while executing
the following statements. Please note that the log statement refers to
op->reply while the following if statement refers to op->post! (this is
cut and paste from the orginal source): 

   jk_log(l, JK_LOG_DEBUG,
     "ajp_send_request 2: "
     "request body to send %d - request body to resend %d\n",
     ae->left_bytes_to_send, jk_b_get_len(op->reply) - AJP_HEADER_LEN);

   if (jk_b_get_len(op->post) > AJP_HEADER_LEN) {
       if(!ajp_connection_tcp_send_message(ae, op->post, l)) {
           jk_log(l, JK_LOG_ERROR, "Error resending request body\n");
           return JK_FALSE;
       }

As we think that POST-recovery is buggy, we tried to disable
POST-recovery completly. This way our version is a bit more pessimistic
about failover, but it seems to work. We don't understand why mod_jk
should try to recover after it i.e. already received data from the
tomcat -- it should assume that the transaction has already been
committed and shouldn't issue another one. 

We are still worried about the session mixup, the case when mod_jk
resent a header with a different (old) body. We can't reproduce it and
therefore we hesitate to use mod_jk in a production environment. 

Can you help reproducing this bug and/or fixing POST-recovery? We have
attached the original source, the patched source and the patch.

Thanks in advance, 

Alexander Schwartz.
 
-- 
Alexander Schwartz (alexander.schwartz@gmx.net)
http://www.ahus1.de

Re: failover-problem and session mixup: jakarta-tomcat-connectors/mod_jk: jk_ajp_common.c

Posted by Henri Gomez <hg...@apache.org>.
Alexander Schwartz a écrit :

> Hello Henri,
> 
> Am Fr, den 06.02.2004 schrieb Henri Gomez um 10:15:
> 
> 
>>Strange, also I need a complete mod_jk.log for study.
> 
> 
> OK, here is the first part of my tests with mod_jk from CVS: 
> 
> Test 1: 
> 
>    * run apache/mod_jk with cluster and failover (config included) 
>    * tc1 is offline 
>    * tc2 is a real tomcat
> 
> After the apache start the first request (post of login.html, included)
> is directed to tc1, but it doesn't response. The request is directed to
> tc2, and EchoFilter.java echos the POST-data to the client. This is OK! 
> 
> Trace: jk.log.onlytc2runs
> 
> Test 2:
> 
>    * run apache/mod_jk with cluster and failover (config included) 
>    * tc1 is a simple netcat (nc -l -p 9010 localhost) 
>    * tc2 is a real tomcat
> 
> After the apache starts the first request (post of login.html, included)
> is directed to tc1. netcat answers the connection and prints out some
> garbage on the console. Then you kill netcat (^C). Then mod_jk redirects
> the request to tc2. ==> here mod_jk "forgets" the POST-data and no data
> is shown to the client!

Well netcat didn't handle ajp13 so it may be the problem.

Strange, jk see it should send the 19 bytes to the second tomcat
but didn't send the exact code.

Could you send also the login.html ?


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: JK2 release delayed one week ? WAS: POST recovery in JK and JK2 HEAD

Posted by Henri Gomez <hg...@apache.org>.
Henri Gomez wrote:

> Did you see my request for release delay ?
> 
> The POST patch is important, and I'd like to see it in jk2 2.0.4, I 
> think I may delay the release for one week if others tomcat-dev agreed.
> 
> I wan't to make the behaviour configurable, ie abort or/not if Tomcat
> failed during sending the reply and if Tomcat get the request but didn't
> send the reply, configuration should be at worker level since the
> admins/devels know about the remote side application level.
> 
> Gleen, Jf, Mladen, Kurt, are you agree to delay the jk2 release for one
> week, time for us to include these code in both jk and jk2 and make it
> configurable ?
> 
> Vote please

Nobody object ?

Great, I'll delay the jk 2.0.4 release to next week, time for me to
add the POST recovery configurable schema and for US to fix some of
the still open bugzilla reports.

Gentlemens, IIS, JNI, modules dependances and others are waiting for us.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: JK2 release delayed one week ? WAS: POST recovery in JK and JK2 HEAD

Posted by Kurt Miller <tr...@apache.org>.
From: "Henri Gomez" <hg...@apache.org>
> Did you see my request for release delay ?
>
> The POST patch is important, and I'd like to see it in jk2 2.0.4, I
> think I may delay the release for one week if others tomcat-dev
agreed.
>
> I wan't to make the behaviour configurable, ie abort or/not if
Tomcat
> failed during sending the reply and if Tomcat get the request but
didn't
> send the reply, configuration should be at worker level since the
> admins/devels know about the remote side application level.
>
> Gleen, Jf, Mladen, Kurt, are you agree to delay the jk2 release for
one
> week, time for us to include these code in both jk and jk2 and make
it
> configurable ?
>
> Vote please
>

+0

I'm ok with the delay but I don't have time this week to help.

-Kurt


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


JK2 release delayed one week ? WAS: POST recovery in JK and JK2 HEAD

Posted by Henri Gomez <hg...@apache.org>.
Did you see my request for release delay ?

The POST patch is important, and I'd like to see it in jk2 2.0.4, I 
think I may delay the release for one week if others tomcat-dev agreed.

I wan't to make the behaviour configurable, ie abort or/not if Tomcat
failed during sending the reply and if Tomcat get the request but didn't
send the reply, configuration should be at worker level since the
admins/devels know about the remote side application level.

Gleen, Jf, Mladen, Kurt, are you agree to delay the jk2 release for one
week, time for us to include these code in both jk and jk2 and make it
configurable ?

Vote please

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: POST recovery in JK and JK2 HEAD

Posted by Henri Gomez <hg...@apache.org>.
Alexander Schwartz wrote:
>>>THIS DOES NOT FIX the problem with the output when tomcat already sent
>>>data to the client (see my mail date Thu, 12 Feb 2004 23:33:34 +0100),
>>>
>>>My two cents: when the tomcat fails after data has been sent to the
>>>client, assume that the request is complete, i.e. return JK_TRUE
>>>(otherwise apache will add some error messages to the reply).
>>
>>Ok, if you have fix for jk AND jk2, thanks to provide them quickly so we
>>could include in in 2.0.4 and 1.2.6 release.
> 
> 
> This is not as easy as I thought: I have extended ajp_get_reply() and
> ajp_process_callback() to keep track if the headers have already been
> sent.
> 
> The following considerations have been made:
> 
>    * after data has been sent to the client don't try to recover
>      from a tomcat has failure

Seems the correct behaviour.

>    * if I return JK_FALSE with recoverable = JK_FALSE apache will
>      append its standard error page. This might look quite ugly, but
>      this way we get proper access.log entries. This might also trigger
>      some error handling in apache (closing the socket even if client
>      tried keepalive and tomcat sent a content length?)

Good.

>    * it's up to you to decide if mod_jk should try to recover after
>      when no headers have been sent (see tag DISCUSSION in code)

If no headers has been returned by Tomcat ? Interesting point since
we couldn't be sure he get the request.

> The best thing to do after a tomcat failure (after data has been already
> sent to the client) would be to mark it as not recoverable, write a proper
> log entry in access.log and to force apache to close this connection
> immediately without sending any other data. This should handle any
> problems arising from chunked responses and/or content-length headers. But
> I don't know how to implement that.
> 
> The included patch is only for jk, not jk2.

This patch is important, and I'd like to see it in jk2 2.0.4, I think I 
may delay the release for one week if others tomcat-dev agreed.

I wan't to make the behaviour configurable, ie abort or/not if Tomcat
failed during sending the reply and if Tomcat get the request but didn't
send the reply, configuration should be at worker level since the 
admins/devels know about the remote side application level.

Gleen, Jf, Mladen, Kurt, are you agree to delay the jk2 release for one
week, time for us to include these code in both jk and jk2 and make it
configurable ?

Vote please


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: POST recovery in JK and JK2 HEAD

Posted by Henri Gomez <hg...@apache.org>.
Ok, I make the code configurable with a worker option,
recovery_options.

By default we keep the current behaviour, ie allways recover.

Set recovery_options (bitfield) to 1 to make reovery stopped if
tomcat get all request and to 2 to make recovery stopped if tomcat
send the headers to clients.

To have both set recovery_options to 3..

Thanks to test and validate before I see how to port this to jk2



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: POST recovery in JK and JK2 HEAD

Posted by Alexander Schwartz <al...@gmx.net>.
> > THIS DOES NOT FIX the problem with the output when tomcat already sent
> > data to the client (see my mail date Thu, 12 Feb 2004 23:33:34 +0100),
> >
> > My two cents: when the tomcat fails after data has been sent to the
> > client, assume that the request is complete, i.e. return JK_TRUE
> > (otherwise apache will add some error messages to the reply).
>
> Ok, if you have fix for jk AND jk2, thanks to provide them quickly so we
> could include in in 2.0.4 and 1.2.6 release.

This is not as easy as I thought: I have extended ajp_get_reply() and
ajp_process_callback() to keep track if the headers have already been
sent.

The following considerations have been made:

   * after data has been sent to the client don't try to recover
     from a tomcat has failure

   * if I return JK_FALSE with recoverable = JK_FALSE apache will
     append its standard error page. This might look quite ugly, but
     this way we get proper access.log entries. This might also trigger
     some error handling in apache (closing the socket even if client
     tried keepalive and tomcat sent a content length?)

   * it's up to you to decide if mod_jk should try to recover after
     when no headers have been sent (see tag DISCUSSION in code)

The best thing to do after a tomcat failure (after data has been already
sent to the client) would be to mark it as not recoverable, write a proper
log entry in access.log and to force apache to close this connection
immediately without sending any other data. This should handle any
problems arising from chunked responses and/or content-length headers. But
I don't know how to implement that.

The included patch is only for jk, not jk2.

Alex.

-- 
Alexander Schwartz (alexander.schwartz@gmx.net)
http://www.ahus1.de


Re: POST recovery in JK and JK2 HEAD

Posted by Henri Gomez <hg...@apache.org>.
Alexander Schwartz wrote:

>>I commited the fixes for the POST recovery in JK and JK2
>>when in LB mode which should solve this major problem.
>>
>>Could Alexander who is the original reporter validate the fix ?
> 
> 
> YES and NO:
> 
> Post recovery works now in the scenario, the loadbalancer doesn't forget
> the post body when a tomcat fails. 
> 
> THIS DOES NOT FIX the problem with the output when tomcat already sent
> data to the client (see my mail date Thu, 12 Feb 2004 23:33:34 +0100),
> but you have already been discussing this under the subject "Mod_Jk2 -
> Default Worker".
> 
> My two cents: when the tomcat fails after data has been sent to the
> client, assume that the request is complete, i.e. return JK_TRUE
> (otherwise apache will add some error messages to the reply). 

Ok, if you have fix for jk AND jk2, thanks to provide them quickly so we 
could include in in 2.0.4 and 1.2.6 release.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: POST recovery in JK and JK2 HEAD

Posted by Alexander Schwartz <al...@gmx.net>.
> I commited the fixes for the POST recovery in JK and JK2
> when in LB mode which should solve this major problem.
>
> Could Alexander who is the original reporter validate the fix ?

YES and NO:

Post recovery works now in the scenario, the loadbalancer doesn't forget
the post body when a tomcat fails. 

THIS DOES NOT FIX the problem with the output when tomcat already sent
data to the client (see my mail date Thu, 12 Feb 2004 23:33:34 +0100),
but you have already been discussing this under the subject "Mod_Jk2 -
Default Worker".

My two cents: when the tomcat fails after data has been sent to the
client, assume that the request is complete, i.e. return JK_TRUE
(otherwise apache will add some error messages to the reply). 

Alex.

-- 
Alexander Schwartz (alexander.schwartz@gmx.net)
http://www.ahus1.de


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


POST recovery in JK and JK2 HEAD

Posted by Henri Gomez <hg...@apache.org>.
I commited the fixes for the POST recovery in JK and JK2
when in LB mode which should solve this major problem.

Thanks to take a look at it

Could Alexander who is the original reporter validate the fix ?


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: failover-problem and session mixup: jakarta-tomcat-connectors/mod_jk: jk_ajp_common.c

Posted by Henri Gomez <hg...@apache.org>.
Alexander Schwartz a écrit :

> Am Di, den 10.02.2004 schrieb Henri Gomez um 15:52:
> 
> 
>>To fix this serious bug we should modify the current service API.
>>
>>We should store the POSTED datas in the jk_ws_service_t area and
>>not in ajp_operation_t, as such the first worker will feed the POST
>>datas in an area which will be available to the second one.
>>
>>Aternate idea are of course more than welcome;
> 
> 
> As I understand it mod_jk is "stable", almost "deprecated", and mod_jk2
> is "the future". Therefore I suggest: 
> 
>    * no API change in mod_jk
>    * mark the operation as unrecoverable when an error occurs after
>      the headers have been sent to the tomcat, that is only fixing
>      bugs and trying not to do big changes 
>    * concentrate your efforts on mod_jk2 and give people a reason to 
>      upgrade :)
> 
> Marking the operation as unrecoverable might also solve the other
> (lb-)problem: when you shut down the first tomcat after it has already
> sent some data to the client mod_jk forwards the request to the second
> tomcat and appends the response of the second tomcat to the response of
> the first tomcat. I'll deliver a sample jk.log soon. 
> 
> I have prepared a patch for 1.2.4/1.2.5, and I am happy to port it to
> HEAD -- if someone checks that it leaves no loose ends.
> 
> Thanks for taking this serious.
> 
> Alex.
> 
> PS: this "empty POST" bug is not the explanation for the session mixup
> (yet)? Any ideas on that one?

Well I'm sure we could update the API to have this problem fixed.

The post buffer used for recovery should be create in service and
passed to the differents workers, making the POST recovery working
for ajp and lb workers.

If nobody have objections I'll take a look at this since I don't like
the idea of having something working for only HALF of HTTP protocol.



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: failover-problem and session mixup: jakarta-tomcat-connectors/mod_jk: jk_ajp_common.c

Posted by Alexander Schwartz <al...@gmx.net>.
Am Mi, den 11.02.2004 schrieb Henri Gomez um 10:57:

> Ok, I commited changes in CVS which should fix problem in POST recovery.
> 
> Thanks to take a look at it

OK, POST recovery seems to work now in the scenario i have described:
Tomcat fails after receiving the request but before sending a reply.
POST data is recovered and resent to the other tomcat. Good!

I now have the trace I promised for the second challenge: tomcat fails
while sending data to the client. Here comes the test: 

  * set up two tomcats
  * use the extended EchoFilter.java that sends one byte 
    each second for ten seconds
  * send a request to the first one (take the login.html provided)
  * use "kill -9 [pid]" on the first one
  * see the following reply appearing in the window of your browser: 

---------------------------------------------
...HTTP/1.1 200 OK
Date: Thu, 12 Feb 2004 22:15:30 GMT
Server: Apache/1.3.29 (Debian GNU/Linux) PHP/4.3.3 mod_ssl/2.8.14 OpenSSL/0.9.7b mod_jk/1.2.6-dev
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Pragma: no-cache
Cache-Control: no-cache
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive, Keep-Alive
Transfer-Encoding: chunked, chunked
Content-Type: text/plain
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Pragma: no-cache
Cache-Control: no-cache

..........login=aaaa&pin=bbbb
---------------------------------------------

The first tomcat has been killed after three seconds (browser has
received the header and shows one dot per second). Then another header
and another body is sent to the browser and displayed -- the browser
accepts the second header as part of the body. 

If you would have used telnet to trigger the request you would have seen
two Headers. 

This is not specific to POST-Requests, the same is true for
GET-Requests. Do you still want to recover in this scenario?

Alex.

-- 
Alexander Schwartz (alexander.schwartz@gmx.net)
http://www.ahus1.de

Re: failover-problem and session mixup: jakarta-tomcat-connectors/mod_jk: jk_ajp_common.c

Posted by Henri Gomez <hg...@apache.org>.
Alexander Schwartz a écrit :

> Am Di, den 10.02.2004 schrieb Henri Gomez um 15:52:
> 
> 
>>To fix this serious bug we should modify the current service API.
>>
>>We should store the POSTED datas in the jk_ws_service_t area and
>>not in ajp_operation_t, as such the first worker will feed the POST
>>datas in an area which will be available to the second one.
>>
>>Aternate idea are of course more than welcome;
> 
> 
> As I understand it mod_jk is "stable", almost "deprecated", and mod_jk2
> is "the future". Therefore I suggest: 
> 
>    * no API change in mod_jk
>    * mark the operation as unrecoverable when an error occurs after
>      the headers have been sent to the tomcat, that is only fixing
>      bugs and trying not to do big changes 
>    * concentrate your efforts on mod_jk2 and give people a reason to 
>      upgrade :)
> 
> Marking the operation as unrecoverable might also solve the other
> (lb-)problem: when you shut down the first tomcat after it has already
> sent some data to the client mod_jk forwards the request to the second
> tomcat and appends the response of the second tomcat to the response of
> the first tomcat. I'll deliver a sample jk.log soon. 

Ok, I commited changes in CVS which should fix problem in POST recovery.

Thanks to take a look at it

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: failover-problem and session mixup: jakarta-tomcat-connectors/mod_jk: jk_ajp_common.c

Posted by Alexander Schwartz <al...@gmx.net>.
Am Di, den 10.02.2004 schrieb Henri Gomez um 15:52:

> To fix this serious bug we should modify the current service API.
> 
> We should store the POSTED datas in the jk_ws_service_t area and
> not in ajp_operation_t, as such the first worker will feed the POST
> datas in an area which will be available to the second one.
> 
> Aternate idea are of course more than welcome;

As I understand it mod_jk is "stable", almost "deprecated", and mod_jk2
is "the future". Therefore I suggest: 

   * no API change in mod_jk
   * mark the operation as unrecoverable when an error occurs after
     the headers have been sent to the tomcat, that is only fixing
     bugs and trying not to do big changes 
   * concentrate your efforts on mod_jk2 and give people a reason to 
     upgrade :)

Marking the operation as unrecoverable might also solve the other
(lb-)problem: when you shut down the first tomcat after it has already
sent some data to the client mod_jk forwards the request to the second
tomcat and appends the response of the second tomcat to the response of
the first tomcat. I'll deliver a sample jk.log soon. 

I have prepared a patch for 1.2.4/1.2.5, and I am happy to port it to
HEAD -- if someone checks that it leaves no loose ends.

Thanks for taking this serious.

Alex.

PS: this "empty POST" bug is not the explanation for the session mixup
(yet)? Any ideas on that one?
-- 
Alexander Schwartz (alexander.schwartz@gmx.net)
http://www.ahus1.de

Re: failover-problem and session mixup: jakarta-tomcat-connectors/mod_jk: jk_ajp_common.c

Posted by Henri Gomez <hg...@apache.org>.
> 
> I see where is the problem.
> 
> The POST is saved in op->post by ajp service, but in lb mode, if the 
> first ajp connection failed, lb try to serv the second one and sus 
> recall ajp service WHICH reset the op->post ;(
> 
> I should now see how to fix the problem (not easy).

To fix this serious bug we should modify the current service API.

We should store the POSTED datas in the jk_ws_service_t area and
not in ajp_operation_t, as such the first worker will feed the POST
datas in an area which will be available to the second one.

Aternate idea are of course more than welcome;

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: failover-problem and session mixup: jakarta-tomcat-connectors/mod_jk: jk_ajp_common.c

Posted by Henri Gomez <hg...@apache.org>.
Henri Gomez a écrit :

> Alexander Schwartz a écrit :
> 
>> Hello Henri,
>>
>> Am Fr, den 06.02.2004 schrieb Henri Gomez um 10:15:
>>
>>
>>> Strange, also I need a complete mod_jk.log for study.
>>
>>
>>
>> OK, here is the first part of my tests with mod_jk from CVS:
>> Test 1:
>>    * run apache/mod_jk with cluster and failover (config included)    
>> * tc1 is offline    * tc2 is a real tomcat
>>
>> After the apache start the first request (post of login.html, included)
>> is directed to tc1, but it doesn't response. The request is directed to
>> tc2, and EchoFilter.java echos the POST-data to the client. This is OK!
>> Trace: jk.log.onlytc2runs
>>
>> Test 2:
>>
>>    * run apache/mod_jk with cluster and failover (config included)    
>> * tc1 is a simple netcat (nc -l -p 9010 localhost)    * tc2 is a real 
>> tomcat
>>
>> After the apache starts the first request (post of login.html, included)
>> is directed to tc1. netcat answers the connection and prints out some
>> garbage on the console. Then you kill netcat (^C). Then mod_jk redirects
>> the request to tc2. ==> here mod_jk "forgets" the POST-data and no data
>> is shown to the client!
>>
>> Trace: jk.log.netcatdiedfailovertotc2
> 
> 
> Ok, I've got the same settings here, I'll investigate and try to fix :)

I see where is the problem.

The POST is saved in op->post by ajp service, but in lb mode, if the 
first ajp connection failed, lb try to serv the second one and sus 
recall ajp service WHICH reset the op->post ;(

I should now see how to fix the problem (not easy).


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: failover-problem and session mixup: jakarta-tomcat-connectors/mod_jk: jk_ajp_common.c

Posted by Henri Gomez <hg...@apache.org>.
Alexander Schwartz a écrit :

> Hello Henri,
> 
> Am Fr, den 06.02.2004 schrieb Henri Gomez um 10:15:
> 
> 
>>Strange, also I need a complete mod_jk.log for study.
> 
> 
> OK, here is the first part of my tests with mod_jk from CVS: 
> 
> Test 1: 
> 
>    * run apache/mod_jk with cluster and failover (config included) 
>    * tc1 is offline 
>    * tc2 is a real tomcat
> 
> After the apache start the first request (post of login.html, included)
> is directed to tc1, but it doesn't response. The request is directed to
> tc2, and EchoFilter.java echos the POST-data to the client. This is OK! 
> 
> Trace: jk.log.onlytc2runs
> 
> Test 2:
> 
>    * run apache/mod_jk with cluster and failover (config included) 
>    * tc1 is a simple netcat (nc -l -p 9010 localhost) 
>    * tc2 is a real tomcat
> 
> After the apache starts the first request (post of login.html, included)
> is directed to tc1. netcat answers the connection and prints out some
> garbage on the console. Then you kill netcat (^C). Then mod_jk redirects
> the request to tc2. ==> here mod_jk "forgets" the POST-data and no data
> is shown to the client!
> 
> Trace: jk.log.netcatdiedfailovertotc2

Ok, I've got the same settings here, I'll investigate and try to fix :)

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: failover-problem and session mixup: jakarta-tomcat-connectors/mod_jk: jk_ajp_common.c

Posted by Alexander Schwartz <al...@gmx.net>.
Hello Henri,

Am Fr, den 06.02.2004 schrieb Henri Gomez um 10:15:

> Strange, also I need a complete mod_jk.log for study.

OK, here is the first part of my tests with mod_jk from CVS: 

Test 1: 

   * run apache/mod_jk with cluster and failover (config included) 
   * tc1 is offline 
   * tc2 is a real tomcat

After the apache start the first request (post of login.html, included)
is directed to tc1, but it doesn't response. The request is directed to
tc2, and EchoFilter.java echos the POST-data to the client. This is OK! 

Trace: jk.log.onlytc2runs

Test 2:

   * run apache/mod_jk with cluster and failover (config included) 
   * tc1 is a simple netcat (nc -l -p 9010 localhost) 
   * tc2 is a real tomcat

After the apache starts the first request (post of login.html, included)
is directed to tc1. netcat answers the connection and prints out some
garbage on the console. Then you kill netcat (^C). Then mod_jk redirects
the request to tc2. ==> here mod_jk "forgets" the POST-data and no data
is shown to the client!

Trace: jk.log.netcatdiedfailovertotc2

Tomorrow I'll trace the problem when tc1 fails after it has already sent
header and data to the client. 

Alex.

-- 
Alexander Schwartz (alexander.schwartz@gmx.net)
http://www.ahus1.de

Re: failover-problem and session mixup: jakarta-tomcat-connectors/mod_jk: jk_ajp_common.c

Posted by Henri Gomez <hg...@apache.org>.
Alexander Schwartz a écrit :

>>>I'd really like to use mod_jk open source software in our production
>>>environment, but I need to make sure it's strong enough for production.
>>>I need some advice on the two issues (as far as I can see there has been
>>>no commit on CVS and/or discussion results)
>>>
>>>   * do you think the POST-recovery caused the session mix-up?
>>>
>>>   * does our patch successfully eliminate the problem by disabling 
>>>     POST-recovery?
>>
>>I'd like to see this recovery fixed instead of removing it.
> 
> 
> but I need something working now :( -- thefore I asked if my code is a
> working, although i know it is not perfect seen with your eyes.
> 
> 
>>The idea is to use buffers to store request datas (headers/datas).
> 
> 
> OK, understood.
> 
> 
>>What's the exact problem.
>>You send request (headers / datas) to tomcat1.
>>This one fail when sending reply or didn't reply at all ?
> 
> 
> I don't know when the session mix up happens, and I was unable to
> reproduce it. But I was to reproduce the following: 
> 
>    (a) mod_jk sends the request and data to tomcat1. Tomcat1 closes the
> connection. mod_jk tries to recover and sends the request with no data
> to the second tomcat. Sending no data is definitely wrong. I also argue
> that this is dangerous as a transaction may be triggered twice by
> sending the request a second time. 

Could you send a complete mod_jk.log in DEBUG mode ?

> Use netcat ("nc -l -p 8080") to simulate a tomcat1 on port 8080
> receiving the headers. Press ^C to simulate the failure of tomcat1. Use
> a "real" tomcat2 for failover.

netcat should handle AJP13, not HTTP, so it should be 8009.

>    (b) mod_jk sends the request and data to tomcat1. mod_jk receives
> header and data from tomcat, but the response is not yet complete.
> tomcat1 closes the connection. mod_jk tries to recover and sends the
> request with no data to the second tomcat. The output of the second
> tomcat is appended to the output of the first tomcat. This is definitely
> wrong.

Strange, also I need a complete mod_jk.log for study.

> I used the attached filter to set up a test case for this. Use two
> tomcats, and shut down the first tomcat when it is processing its
> request.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: failover-problem and session mixup: jakarta-tomcat-connectors/mod_jk: jk_ajp_common.c

Posted by Alexander Schwartz <al...@gmx.net>.
> > I'd really like to use mod_jk open source software in our production
> > environment, but I need to make sure it's strong enough for production.
> > I need some advice on the two issues (as far as I can see there has been
> > no commit on CVS and/or discussion results)
> > 
> >    * do you think the POST-recovery caused the session mix-up?
> > 
> >    * does our patch successfully eliminate the problem by disabling 
> >      POST-recovery?
> 
> I'd like to see this recovery fixed instead of removing it.

but I need something working now :( -- thefore I asked if my code is a
working, although i know it is not perfect seen with your eyes.

> The idea is to use buffers to store request datas (headers/datas).

OK, understood.

> What's the exact problem.
> You send request (headers / datas) to tomcat1.
> This one fail when sending reply or didn't reply at all ?

I don't know when the session mix up happens, and I was unable to
reproduce it. But I was to reproduce the following: 

   (a) mod_jk sends the request and data to tomcat1. Tomcat1 closes the
connection. mod_jk tries to recover and sends the request with no data
to the second tomcat. Sending no data is definitely wrong. I also argue
that this is dangerous as a transaction may be triggered twice by
sending the request a second time. 

Use netcat ("nc -l -p 8080") to simulate a tomcat1 on port 8080
receiving the headers. Press ^C to simulate the failure of tomcat1. Use
a "real" tomcat2 for failover.

   (b) mod_jk sends the request and data to tomcat1. mod_jk receives
header and data from tomcat, but the response is not yet complete.
tomcat1 closes the connection. mod_jk tries to recover and sends the
request with no data to the second tomcat. The output of the second
tomcat is appended to the output of the first tomcat. This is definitely
wrong.

I used the attached filter to set up a test case for this. Use two
tomcats, and shut down the first tomcat when it is processing its
request.

Alex.

> 
> > ------------------------------------------------------------------------
> > 
> > --- jk_ajp_common.c.old	Fri Jan 23 16:26:12 2004
> > +++ jk_ajp_common.c	Fri Jan 23 16:28:02 2004
> > @@ -963,10 +963,16 @@
> >       * or Tomcat crashed. In any case we cannot recover this.
> >       */
> >  
> > +    // as+gj/20040123: we don't want to try the buggy POST recovery as it
> > +    // seems to repost buggy data 
> > +    // BUT: doesn't work!
> > +    // op->recoverable = JK_FALSE;
> > +
> >      jk_log(l, JK_LOG_DEBUG,
> >             "ajp_send_request 2: "
> > -           "request body to send %d - request body to resend %d\n", 
> > -           ae->left_bytes_to_send, jk_b_get_len(op->reply) - AJP_HEADER_LEN);
> > +           "request body to send %d - request body to resend %d/%d\n", 
> > +           ae->left_bytes_to_send, jk_b_get_len(op->reply) - AJP_HEADER_LEN,
> > +           jk_b_get_len(op->post) - AJP_HEADER_LEN);
> >  
> >      /*
> >       * POST recovery job is done here.
> > @@ -977,10 +983,18 @@
> >       * remote Tomcat
> >       */
> >      if (jk_b_get_len(op->post) > AJP_HEADER_LEN) {
> > -        if(!ajp_connection_tcp_send_message(ae, op->post, l)) {
> > -            jk_log(l, JK_LOG_ERROR, "Error resending request body\n");
> > -            return JK_FALSE;
> > -        }
> > +      // as+gj/20040123: seems to be buggy, doesn't fit the debug output
> > +      // above, customers complain about seeing wrong user's data when doing
> > +      // a login-POST
> > +      //  if(!ajp_connection_tcp_send_message(ae, op->post, l)) {
> > +      //      jk_log(l, JK_LOG_ERROR, "Error resending request body\n");
> > +      //      return JK_FALSE;
> > +      //  }
> > +      
> > +      // as+gj/20040123 recovery is disabled above shoudn't happen!
> > +      jk_log(l, JK_LOG_ERROR, "Shouldn't be here resending request body! (as+gj/20040123)\n");
> > +      op->recoverable = JK_FALSE;
> > +      return JK_FALSE;
> >      }
> >      else {
> >          /* We never sent any POST data and we check if we have to send at
> > @@ -1009,6 +1023,8 @@
> >              s->content_read = len;
> >              if (!ajp_connection_tcp_send_message(ae, op->post, l)) {
> >                  jk_log(l, JK_LOG_ERROR, "Error sending request body\n");
> > +                // as+gj/20040123
> > +                op->recoverable = JK_FALSE;
> >                  return JK_FALSE;
> >              }  
> >          }
> > @@ -1279,6 +1295,9 @@
> >                       * receiving upload data and we must consider that
> >                       * operation is no more recoverable
> >                       */
> > +                    // as+gj/20040123:
> > +                    // don't want to recover
> > +                    op->recoverable = JK_FALSE;
> >                      if (! op->recoverable) {
> >                          *is_recoverable_error = JK_FALSE;
> >                          jk_log(l, JK_LOG_ERROR,

-- 
Alexander Schwartz (alexander.schwartz@gmx.net)
http://www.ahus1.de

Re: failover-problem and session mixup: jakarta-tomcat-connectors/mod_jk: jk_ajp_common.c

Posted by Henri Gomez <hg...@apache.org>.
Alexander Schwartz a écrit :
> Hello Henri, hello mod_jk-Developers,
> 
> Am Di, den 27.01.2004 schrieb Henri Gomez um 18:00:

> I'd really like to use mod_jk open source software in our production
> environment, but I need to make sure it's strong enough for production.
> I need some advice on the two issues (as far as I can see there has been
> no commit on CVS and/or discussion results)
> 
>    * do you think the POST-recovery caused the session mix-up?
> 
>    * does our patch successfully eliminate the problem by disabling 
>      POST-recovery?

I'd like to see this recovery fixed instead of removing it.

The idea is to use buffers to store request datas (headers/datas).

What's the exact problem.

You send request (headers / datas) to tomcat1.

This one fail when sending reply or didn't reply at all ?


> ------------------------------------------------------------------------
> 
> --- jk_ajp_common.c.old	Fri Jan 23 16:26:12 2004
> +++ jk_ajp_common.c	Fri Jan 23 16:28:02 2004
> @@ -963,10 +963,16 @@
>       * or Tomcat crashed. In any case we cannot recover this.
>       */
>  
> +    // as+gj/20040123: we don't want to try the buggy POST recovery as it
> +    // seems to repost buggy data 
> +    // BUT: doesn't work!
> +    // op->recoverable = JK_FALSE;
> +
>      jk_log(l, JK_LOG_DEBUG,
>             "ajp_send_request 2: "
> -           "request body to send %d - request body to resend %d\n", 
> -           ae->left_bytes_to_send, jk_b_get_len(op->reply) - AJP_HEADER_LEN);
> +           "request body to send %d - request body to resend %d/%d\n", 
> +           ae->left_bytes_to_send, jk_b_get_len(op->reply) - AJP_HEADER_LEN,
> +           jk_b_get_len(op->post) - AJP_HEADER_LEN);
>  
>      /*
>       * POST recovery job is done here.
> @@ -977,10 +983,18 @@
>       * remote Tomcat
>       */
>      if (jk_b_get_len(op->post) > AJP_HEADER_LEN) {
> -        if(!ajp_connection_tcp_send_message(ae, op->post, l)) {
> -            jk_log(l, JK_LOG_ERROR, "Error resending request body\n");
> -            return JK_FALSE;
> -        }
> +      // as+gj/20040123: seems to be buggy, doesn't fit the debug output
> +      // above, customers complain about seeing wrong user's data when doing
> +      // a login-POST
> +      //  if(!ajp_connection_tcp_send_message(ae, op->post, l)) {
> +      //      jk_log(l, JK_LOG_ERROR, "Error resending request body\n");
> +      //      return JK_FALSE;
> +      //  }
> +      
> +      // as+gj/20040123 recovery is disabled above shoudn't happen!
> +      jk_log(l, JK_LOG_ERROR, "Shouldn't be here resending request body! (as+gj/20040123)\n");
> +      op->recoverable = JK_FALSE;
> +      return JK_FALSE;
>      }
>      else {
>          /* We never sent any POST data and we check if we have to send at
> @@ -1009,6 +1023,8 @@
>              s->content_read = len;
>              if (!ajp_connection_tcp_send_message(ae, op->post, l)) {
>                  jk_log(l, JK_LOG_ERROR, "Error sending request body\n");
> +                // as+gj/20040123
> +                op->recoverable = JK_FALSE;
>                  return JK_FALSE;
>              }  
>          }
> @@ -1279,6 +1295,9 @@
>                       * receiving upload data and we must consider that
>                       * operation is no more recoverable
>                       */
> +                    // as+gj/20040123:
> +                    // don't want to recover
> +                    op->recoverable = JK_FALSE;
>                      if (! op->recoverable) {
>                          *is_recoverable_error = JK_FALSE;
>                          jk_log(l, JK_LOG_ERROR,
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: failover-problem and session mixup: jakarta-tomcat-connectors/mod_jk: jk_ajp_common.c

Posted by Alexander Schwartz <al...@gmx.net>.
Am Fr, den 06.02.2004 schrieb Henri Gomez um 10:13:

> Could you try with the latest code from CVS, since your patch seems
> to be for an older version ?

I've tested with mod_jk 1.2.4/1.2.5, but I will do it again with the
latest Version from CVS with jk.log in DEBUG mode. Will be first thing
Monday morning.

> I'd like to see test case and dumps.

What is a dump? What are your requirements for a good test case?

> I also wonder why the tomcat failed since using the
> prepost_timeout ping/pong could help you there.

It would help, but it has not been released yet (mod_jk 1.2.5 is latest
released version, but it will be in mod_jk 1.2.6) -- but it doesn't
solve problems when a tomcat fails while processing the request.

> netcat should handle AJP13, not HTTP, so it should be 8009.

Sure, yes, it was listening on 8009 and was receiving AJP13. Sorry.

> Questions :
> 
> - Did Tomcat failed while handling the request or was allready
>    broken before ?
>
> - Did you clients used chunked transfert ?
> 
> - You say that sometimes after a POST-failover body data from an
>    old request is sent to the other tomcat when the first connection
>    failed.
>    Do you means that the other tomcat get POST DATA which was never sent
>    by the browser in this request ? Strange since the op->post is reset
>    each time we service a new request.

As far as I was able to trace when the session mixup happend tomcat was
processing data that has been sent about 15 minutes earlier and
delivered the result to another user. I think this was due to the fact
that mod_jk mixed up the POST data. I don't know about chunked
transfers, but this is unlikely as the data was a normal form with data
less than 100 bytes.

What I was able to test was empty POST after the first tomcat failed
while processing the request and mod_jk retried on another tomcat. Wait
for my jk.logs.

Alex. 

-- 
Alexander Schwartz (alexander.schwartz@gmx.net)
http://www.ahus1.de


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: failover-problem and session mixup: jakarta-tomcat-connectors/mod_jk: jk_ajp_common.c

Posted by Henri Gomez <hg...@apache.org>.
Alexander Schwartz a écrit :
> Hello Henri, hello mod_jk-Developers,
> 
> Am Di, den 27.01.2004 schrieb Henri Gomez um 18:00:
> 
> 
>>>we are currently experiencing some problems with mod_jk with
>>>loadbalancing: 
>>>
>>>   (A) when a post-request fails while receiving data from tomcat, the
>>>loadbalancer tries to send the request to the other tomcat, but
>>>"forgets" the post body content (i.e. login and password submitted by
>>>the user). The size of the body content is only a few bytes (< 100), so
>>>it's not the "known" problem with bodies longer than 8k. 
>>>
>>>   (B) it seems that sometimes after a POST-failover body data from an
>>>old request is sent to the other tomcat when the first connection
>>>failed. This leads to a session mix-up & user mix-up!

Could you try with the latest code from CVS, since your patch seems
to be for an older version ?

 From what I see in the code the datas in op->post are sent to the new
tomcat so I don't see where can be the problem.

I'd like to see test case and dumps.

In fact we may have to rewrite the ajp_service():

1) Init Buffers request, post, reply.

2) Feed request buffer and if needed post buffer.

3) Iterate here :

4) Try to send request and if needed post datas to a tomcat.

5) Swith to another tomcat and retry.

A problem in such case is that if there is many POST datas
we'll have a HUGE POST buffer and that datas won't be send
to tomcat immediatly.

So a consensus should be found here :

- Make the web-server buffering the request/post, and
   then send to tomcat's.

- Keep the current behaviour, where jk feed the data to tomcat
   as soon as he get them.


I also wonder why the tomcat failed since using the
prepost_timeout ping/pong could help you there.

Questions :

- Did Tomcat failed while handling the request or was allready
   broken before ?

- Did you clients used chunked transfert ?

- You say that sometimes after a POST-failover body data from an
   old request is sent to the other tomcat when the first connection
   failed.
   Do you means that the other tomcat get POST DATA which was never sent
   by the browser in this request ? Strange since the op->post is reset
   each time we service a new request.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: failover-problem and session mixup: jakarta-tomcat-connectors/mod_jk: jk_ajp_common.c

Posted by Alexander Schwartz <al...@gmx.net>.
Hello Henri, hello mod_jk-Developers,

Am Di, den 27.01.2004 schrieb Henri Gomez um 18:00:

> > we are currently experiencing some problems with mod_jk with
> > loadbalancing: 
> > 
> >    (A) when a post-request fails while receiving data from tomcat, the
> > loadbalancer tries to send the request to the other tomcat, but
> > "forgets" the post body content (i.e. login and password submitted by
> > the user). The size of the body content is only a few bytes (< 100), so
> > it's not the "known" problem with bodies longer than 8k. 
> > 
> >    (B) it seems that sometimes after a POST-failover body data from an
> > old request is sent to the other tomcat when the first connection
> > failed. This leads to a session mix-up & user mix-up!

[...]

> It used to works but it was before the content-header add-on code.
> 
> This piece of is a nightmare, and I see no easier solution than copying 
> the HEAD+POST in temp buffer but I'd like to have Bill, Mladen and JFC 
> advices...

I'd really like to use mod_jk open source software in our production
environment, but I need to make sure it's strong enough for production.
I need some advice on the two issues (as far as I can see there has been
no commit on CVS and/or discussion results)

   * do you think the POST-recovery caused the session mix-up?

   * does our patch successfully eliminate the problem by disabling 
     POST-recovery?

The patch is attached.

Thanks a lot,
Alexander.

-- 
Alexander Schwartz (alexander.schwartz@gmx.net)
http://www.ahus1.de

Re: [VOTE] 4.1.30 release vote

Posted by Remy Maucherat <re...@apache.org>.
Remy Maucherat wrote:
> Amidst all this junk email ...
> 
> <ballot>
> Release 4.1.30 as Stable:
> [X] Yes
> [ ] No
> </ballot>

We need this release ;)
I promise I won't annoy anyone with 4.1.x after this one :)

Rémy


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [VOTE] 4.1.30 release vote

Posted by jean-frederic clere <jf...@fujitsu-siemens.com>.
Remy Maucherat wrote:
> jean-frederic clere wrote:
> 
>> Remy Maucherat wrote:
>>
>>> Amidst all this junk email ...
>>>
>>> <ballot>
>>> Release 4.1.30 as Stable:
>>> [ ] Yes
>>> [ ] No
>>> </ballot>
>>
>>
>> Could you wait until I have release common/daemon?
> 
> 
> Why ? 4.1.30 doesn't include commons-daemon. (4.1.x uses JavaService, 
> and doesn't ship jsvc)

Oops, only my packaging needs commons-daemon.

> 
> Rémy
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [VOTE] 4.1.30 release vote

Posted by Remy Maucherat <re...@apache.org>.
jean-frederic clere wrote:
> Remy Maucherat wrote:
> 
>> Amidst all this junk email ...
>>
>> <ballot>
>> Release 4.1.30 as Stable:
>> [ ] Yes
>> [ ] No
>> </ballot>
> 
> Could you wait until I have release common/daemon?

Why ? 4.1.30 doesn't include commons-daemon. (4.1.x uses JavaService, 
and doesn't ship jsvc)

Rémy

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [VOTE] 4.1.30 release vote

Posted by jean-frederic clere <jf...@fujitsu-siemens.com>.
Remy Maucherat wrote:
> Amidst all this junk email ...
> 
> <ballot>
> Release 4.1.30 as Stable:
> [ ] Yes
> [ ] No
> </ballot>

Could you wait until I have release common/daemon?

> 
> Rémy
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


[VOTE] 4.1.30 release vote

Posted by Remy Maucherat <re...@apache.org>.
Amidst all this junk email ...

<ballot>
Release 4.1.30 as Stable:
[ ] Yes
[ ] No
</ballot>

Rémy

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: failover-problem and session mixup: jakarta-tomcat-connectors: jk_ajp_common.c

Posted by Henri Gomez <hg...@apache.org>.
jean-frederic clere a écrit :

> Henri Gomez wrote:
> 
>> jean-frederic clere a écrit :
>>
>>> Henri Gomez wrote:
>>>
>>>> Alexander Schwartz a écrit :
>>>>
>>>>> Hello Tomcat-Developers,
>>>>>
>>>>> we are currently experiencing some problems with mod_jk with
>>>>> loadbalancing:
>>>>>    (A) when a post-request fails while receiving data from tomcat, the
>>>>> loadbalancer tries to send the request to the other tomcat, but
>>>>> "forgets" the post body content (i.e. login and password submitted by
>>>>> the user). The size of the body content is only a few bytes (< 
>>>>> 100), so
>>>>> it's not the "known" problem with bodies longer than 8k.
>>>>>    (B) it seems that sometimes after a POST-failover body data from an
>>>>> old request is sent to the other tomcat when the first connection
>>>>> failed. This leads to a session mix-up & user mix-up!
>>>>>
>>>>> The setup is a simple cluster configuration: one apache httpd with
>>>>> mod_ssl in front, mod_jk with one configured loadbalance worker with
>>>>> sticky sessions and two child ajp13 workers in the middle, two tomcats
>>>>> in the back.
>>>>> Versions involved: mod_jk 1.2.4, Tomcat 4.1.27 (but also tested with
>>>>> mod_jk 1.2.5 and Tomcat 4.1.29). Apache on AIX, version 1.3.29. The
>>>>> latest version of jk_ajp_common.c in CVS don't seem to have relevant
>>>>> changes. We have searched the mailinglists, the only source I have 
>>>>> found
>>>>> is in tomcat-user-mailinglist where Jean-Philippe Belanger describes a
>>>>> similar problem in the mails from 14 Jan 2004 (the empty POST body) 
>>>>> and
>>>>> 12 Jan 2004 (the empty POST body and the session mixup). He didn't
>>>>> investigate further but got himself a cisco load balancer. Another 
>>>>> post
>>>>> is here, but I found no replies/solutions.
>>>>>
>>>>> http://www.mail-archive.com/tomcat-dev@jakarta.apache.org/msg48833.html 
>>>>>
>>>>>
>>>>> (A) can be reproduced quite easily using "netcat" as a simulator of 
>>>>> the
>>>>> first tomcat and a second real tomcat. If you kill netcat after it has
>>>>> accepted a POST-connection from a mod_jk, mod_jk will forward the
>>>>> request to the other tomcat without the POST-body
>>>>> But we can't reproduce (B), but it has definitely happened. We suspect
>>>>> that POST-Recovery code might send an old request body while executing
>>>>> the following statements. Please note that the log statement refers to
>>>>> op->reply while the following if statement refers to op->post! 
>>>>> (this is
>>>>> cut and paste from the orginal source): 
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> It used to works but it was before the content-header add-on code.
>>>>
>>>> This piece of is a nightmare, and I see no easier solution than 
>>>> copying the HEAD+POST in temp buffer but I'd like to have Bill, 
>>>> Mladen and JFC advices...
>>>
>>>
>>>
>>>
>>> That is what I am doing in the modified mod_jk2 I use to connect to 
>>> embbed tomcats.
>>
>>
>>
>> Hi JF,
>>
>> Do you means that you're using separate buffers for HEAD/POST ?
> 
> 
> No: I am storing all until I get the end (max 30000 bytes).
> 
>>
>> Could it be backported to jk ?
>>
> 
> I need time to answer the question...
> But I think we have already something in common/jk_ajp_common.c 
> otherwise what op->request and op->post were for?

I added the post for such purpose, so I still wonder where is the problem

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: failover-problem and session mixup: jakarta-tomcat-connectors: jk_ajp_common.c

Posted by jean-frederic clere <jf...@fujitsu-siemens.com>.
Henri Gomez wrote:
> jean-frederic clere a écrit :
> 
>> Henri Gomez wrote:
>>
>>> Alexander Schwartz a écrit :
>>>
>>>> Hello Tomcat-Developers,
>>>>
>>>> we are currently experiencing some problems with mod_jk with
>>>> loadbalancing:
>>>>    (A) when a post-request fails while receiving data from tomcat, the
>>>> loadbalancer tries to send the request to the other tomcat, but
>>>> "forgets" the post body content (i.e. login and password submitted by
>>>> the user). The size of the body content is only a few bytes (< 100), so
>>>> it's not the "known" problem with bodies longer than 8k.
>>>>    (B) it seems that sometimes after a POST-failover body data from an
>>>> old request is sent to the other tomcat when the first connection
>>>> failed. This leads to a session mix-up & user mix-up!
>>>>
>>>> The setup is a simple cluster configuration: one apache httpd with
>>>> mod_ssl in front, mod_jk with one configured loadbalance worker with
>>>> sticky sessions and two child ajp13 workers in the middle, two tomcats
>>>> in the back.
>>>> Versions involved: mod_jk 1.2.4, Tomcat 4.1.27 (but also tested with
>>>> mod_jk 1.2.5 and Tomcat 4.1.29). Apache on AIX, version 1.3.29. The
>>>> latest version of jk_ajp_common.c in CVS don't seem to have relevant
>>>> changes. We have searched the mailinglists, the only source I have 
>>>> found
>>>> is in tomcat-user-mailinglist where Jean-Philippe Belanger describes a
>>>> similar problem in the mails from 14 Jan 2004 (the empty POST body) and
>>>> 12 Jan 2004 (the empty POST body and the session mixup). He didn't
>>>> investigate further but got himself a cisco load balancer. Another post
>>>> is here, but I found no replies/solutions.
>>>>
>>>> http://www.mail-archive.com/tomcat-dev@jakarta.apache.org/msg48833.html
>>>>
>>>> (A) can be reproduced quite easily using "netcat" as a simulator of the
>>>> first tomcat and a second real tomcat. If you kill netcat after it has
>>>> accepted a POST-connection from a mod_jk, mod_jk will forward the
>>>> request to the other tomcat without the POST-body
>>>> But we can't reproduce (B), but it has definitely happened. We suspect
>>>> that POST-Recovery code might send an old request body while executing
>>>> the following statements. Please note that the log statement refers to
>>>> op->reply while the following if statement refers to op->post! (this is
>>>> cut and paste from the orginal source): 
>>>
>>>
>>>
>>>
>>> It used to works but it was before the content-header add-on code.
>>>
>>> This piece of is a nightmare, and I see no easier solution than 
>>> copying the HEAD+POST in temp buffer but I'd like to have Bill, 
>>> Mladen and JFC advices...
>>
>>
>>
>> That is what I am doing in the modified mod_jk2 I use to connect to 
>> embbed tomcats.
> 
> 
> Hi JF,
> 
> Do you means that you're using separate buffers for HEAD/POST ?

No: I am storing all until I get the end (max 30000 bytes).

> 
> Could it be backported to jk ?
> 

I need time to answer the question...
But I think we have already something in common/jk_ajp_common.c otherwise what 
op->request and op->post were for?

> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: failover-problem and session mixup: jakarta-tomcat-connectors: jk_ajp_common.c

Posted by Henri Gomez <hg...@apache.org>.
jean-frederic clere a écrit :
> Henri Gomez wrote:
> 
>> Alexander Schwartz a écrit :
>>
>>> Hello Tomcat-Developers,
>>>
>>> we are currently experiencing some problems with mod_jk with
>>> loadbalancing:
>>>    (A) when a post-request fails while receiving data from tomcat, the
>>> loadbalancer tries to send the request to the other tomcat, but
>>> "forgets" the post body content (i.e. login and password submitted by
>>> the user). The size of the body content is only a few bytes (< 100), so
>>> it's not the "known" problem with bodies longer than 8k.
>>>    (B) it seems that sometimes after a POST-failover body data from an
>>> old request is sent to the other tomcat when the first connection
>>> failed. This leads to a session mix-up & user mix-up!
>>>
>>> The setup is a simple cluster configuration: one apache httpd with
>>> mod_ssl in front, mod_jk with one configured loadbalance worker with
>>> sticky sessions and two child ajp13 workers in the middle, two tomcats
>>> in the back.
>>> Versions involved: mod_jk 1.2.4, Tomcat 4.1.27 (but also tested with
>>> mod_jk 1.2.5 and Tomcat 4.1.29). Apache on AIX, version 1.3.29. The
>>> latest version of jk_ajp_common.c in CVS don't seem to have relevant
>>> changes. We have searched the mailinglists, the only source I have found
>>> is in tomcat-user-mailinglist where Jean-Philippe Belanger describes a
>>> similar problem in the mails from 14 Jan 2004 (the empty POST body) and
>>> 12 Jan 2004 (the empty POST body and the session mixup). He didn't
>>> investigate further but got himself a cisco load balancer. Another post
>>> is here, but I found no replies/solutions.
>>>
>>> http://www.mail-archive.com/tomcat-dev@jakarta.apache.org/msg48833.html
>>>
>>> (A) can be reproduced quite easily using "netcat" as a simulator of the
>>> first tomcat and a second real tomcat. If you kill netcat after it has
>>> accepted a POST-connection from a mod_jk, mod_jk will forward the
>>> request to the other tomcat without the POST-body
>>> But we can't reproduce (B), but it has definitely happened. We suspect
>>> that POST-Recovery code might send an old request body while executing
>>> the following statements. Please note that the log statement refers to
>>> op->reply while the following if statement refers to op->post! (this is
>>> cut and paste from the orginal source): 
>>
>>
>>
>> It used to works but it was before the content-header add-on code.
>>
>> This piece of is a nightmare, and I see no easier solution than 
>> copying the HEAD+POST in temp buffer but I'd like to have Bill, Mladen 
>> and JFC advices...
> 
> 
> That is what I am doing in the modified mod_jk2 I use to connect to 
> embbed tomcats.

Hi JF,

Do you means that you're using separate buffers for HEAD/POST ?

Could it be backported to jk ?



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: failover-problem and session mixup: jakarta-tomcat-connectors: jk_ajp_common.c

Posted by jean-frederic clere <jf...@FUJITSU-SIEMENS.com>.
Henri Gomez wrote:
> Alexander Schwartz a écrit :
> 
>> Hello Tomcat-Developers,
>>
>> we are currently experiencing some problems with mod_jk with
>> loadbalancing:
>>    (A) when a post-request fails while receiving data from tomcat, the
>> loadbalancer tries to send the request to the other tomcat, but
>> "forgets" the post body content (i.e. login and password submitted by
>> the user). The size of the body content is only a few bytes (< 100), so
>> it's not the "known" problem with bodies longer than 8k.
>>    (B) it seems that sometimes after a POST-failover body data from an
>> old request is sent to the other tomcat when the first connection
>> failed. This leads to a session mix-up & user mix-up!
>>
>> The setup is a simple cluster configuration: one apache httpd with
>> mod_ssl in front, mod_jk with one configured loadbalance worker with
>> sticky sessions and two child ajp13 workers in the middle, two tomcats
>> in the back.
>> Versions involved: mod_jk 1.2.4, Tomcat 4.1.27 (but also tested with
>> mod_jk 1.2.5 and Tomcat 4.1.29). Apache on AIX, version 1.3.29. The
>> latest version of jk_ajp_common.c in CVS don't seem to have relevant
>> changes. We have searched the mailinglists, the only source I have found
>> is in tomcat-user-mailinglist where Jean-Philippe Belanger describes a
>> similar problem in the mails from 14 Jan 2004 (the empty POST body) and
>> 12 Jan 2004 (the empty POST body and the session mixup). He didn't
>> investigate further but got himself a cisco load balancer. Another post
>> is here, but I found no replies/solutions.
>>
>> http://www.mail-archive.com/tomcat-dev@jakarta.apache.org/msg48833.html
>>
>> (A) can be reproduced quite easily using "netcat" as a simulator of the
>> first tomcat and a second real tomcat. If you kill netcat after it has
>> accepted a POST-connection from a mod_jk, mod_jk will forward the
>> request to the other tomcat without the POST-body
>> But we can't reproduce (B), but it has definitely happened. We suspect
>> that POST-Recovery code might send an old request body while executing
>> the following statements. Please note that the log statement refers to
>> op->reply while the following if statement refers to op->post! (this is
>> cut and paste from the orginal source): 
> 
> 
> It used to works but it was before the content-header add-on code.
> 
> This piece of is a nightmare, and I see no easier solution than copying 
> the HEAD+POST in temp buffer but I'd like to have Bill, Mladen and JFC 
> advices...

That is what I am doing in the modified mod_jk2 I use to connect to embbed tomcats.

> 
> BTW, could you send the code as diff -Nru ?
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: failover-problem and session mixup: jakarta-tomcat-connectors: jk_ajp_common.c

Posted by Alexander Schwartz <al...@gmx.net>.
Am Di, den 27.01.2004 schrieb Henri Gomez um 18:00:

> It used to works but it was before the content-header add-on code.
> 
> This piece of is a nightmare, and I see no easier solution than copying 
> the HEAD+POST in temp buffer but I'd like to have Bill, Mladen and JFC 
> advices...

My code tries to avoid post recovery completly as my application is at
the moment not safe to process a (POST) reqest twice. I wonder if post
recovery is really needed. 

The most common error for post recovery is the "We will know only at
read time if the remote host closed the connection (half-closed state -
FIN-WAIT2)" (stated i.e. at ajp_get_reply() function comment)

With ping/pong avaliable, is it still needed?

As I looked deeper into you code I found that mod_jk retries the request
even after headers and/or parts of the body have already been sent to
the client. 

To me it seems that ajp_get_reply() needs some extended return value
after it has called ajp_process_callback() to process
JK_AJP13_SEND_HEADERS or JK_AJP13_SEND_BODY_CHUNK to set op->recoverable
to JK_FALSE. 

Again: my code avoids this complicated decisions by promoting less
recovery mechanisms, but early and clean failure :)

Cheers, Alex.  

-- 
Alexander Schwartz (alexander.schwartz@gmx.net)
http://www.ahus1.de


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: failover-problem and session mixup: jakarta-tomcat-connectors: jk_ajp_common.c

Posted by Henri Gomez <hg...@apache.org>.
Alexander Schwartz a écrit :
> Hello Tomcat-Developers,
> 
> we are currently experiencing some problems with mod_jk with
> loadbalancing: 
> 
>    (A) when a post-request fails while receiving data from tomcat, the
> loadbalancer tries to send the request to the other tomcat, but
> "forgets" the post body content (i.e. login and password submitted by
> the user). The size of the body content is only a few bytes (< 100), so
> it's not the "known" problem with bodies longer than 8k. 
> 
>    (B) it seems that sometimes after a POST-failover body data from an
> old request is sent to the other tomcat when the first connection
> failed. This leads to a session mix-up & user mix-up!
> 
> The setup is a simple cluster configuration: one apache httpd with
> mod_ssl in front, mod_jk with one configured loadbalance worker with
> sticky sessions and two child ajp13 workers in the middle, two tomcats
> in the back. 
> 
> Versions involved: mod_jk 1.2.4, Tomcat 4.1.27 (but also tested with
> mod_jk 1.2.5 and Tomcat 4.1.29). Apache on AIX, version 1.3.29. The
> latest version of jk_ajp_common.c in CVS don't seem to have relevant
> changes. We have searched the mailinglists, the only source I have found
> is in tomcat-user-mailinglist where Jean-Philippe Belanger describes a
> similar problem in the mails from 14 Jan 2004 (the empty POST body) and
> 12 Jan 2004 (the empty POST body and the session mixup). He didn't
> investigate further but got himself a cisco load balancer. Another post
> is here, but I found no replies/solutions.
> 
> http://www.mail-archive.com/tomcat-dev@jakarta.apache.org/msg48833.html
> 
> (A) can be reproduced quite easily using "netcat" as a simulator of the
> first tomcat and a second real tomcat. If you kill netcat after it has
> accepted a POST-connection from a mod_jk, mod_jk will forward the
> request to the other tomcat without the POST-body 
> 
> But we can't reproduce (B), but it has definitely happened. We suspect
> that POST-Recovery code might send an old request body while executing
> the following statements. Please note that the log statement refers to
> op->reply while the following if statement refers to op->post! (this is
> cut and paste from the orginal source): 

It used to works but it was before the content-header add-on code.

This piece of is a nightmare, and I see no easier solution than copying 
the HEAD+POST in temp buffer but I'd like to have Bill, Mladen and JFC 
advices...

BTW, could you send the code as diff -Nru ?



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: failover-problem and session mixup: jakarta-tomcat-connectors: jk_ajp_common.c

Posted by Henri Gomez <hg...@apache.org>.
Oups, just see the diff, sorry :)


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org