Hi,
I think, I finally found out what the problem is.

As Bill already said each child process in Apache (Apache 1.3) tries to
generate a connection to Tomcat. If there are more child processes on Apache site
that try to connect than maximal possible Threads in Tomcat (defined by means
of the property maxProcessor) everythings hangs (no more requests will reach
Tomcat). 

So I think I must set the maxProcessors on the Tomcat side equal or a little bit 
higher 
than the property maxClients on the Apache side. 

What do you think?

Regards Karin

-----Original Message-----
From: Krause Karin 
Sent: Donnerstag, 22. Januar 2004 09:19
To: 'Tomcat Users List'
Subject: RE: connectionTimeout


I agree with you that closing the socket on each request isn't 
a good idea. 

But I have the feeling that only if the socket is closed the thread
is freed and Tomcat can accept new input on this thread.

Yesterday I did some more tests and I'd like to explain you one in more detail:
I use
Apache (Apache/1.3.26 (Unix) mod_jk/1.2.4) -> Tomcat 4.1.27
I work with the default sample servlets (the Helloworld Servlet)

The configuration of my CoyoteConnector looks like this:
<Connector 
        className="org.apache.coyote.tomcat4.CoyoteConnector" port="9003" 
        minProcessors="1" maxProcessors="3"  acceptCount="10" debug="3" 
connectionTimeout="120000" 
        useURIValidationHack="true" 
        protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler" 
proxyPort="443" scheme="https"/>

I did only sequential requests. So I did my first and get the answer back, the second 
and again I get
the answer back. So than I did the third request and I had to wait quite a while (and 
as I recognized
in my mod_jk logging output I had to wait 2 minutes (like I set my timeout)).
SEE:

[Wed Jan 21 16:32:50 2004]  [jk_ajp_common.c (966)]: ajp_send_request 2: request body 
to send 0 - request body to resend 0
                --> Here the Request is sent to Tomcat
[Wed Jan 21 16:34:21 2004]  [jk_ajp_common.c (804)]: received from ajp13 #60
                --> Here I got the answer back (takes 2 minutes)

In the Tomcat log I saw the following output:

20040122:085055.660 LFFM01 NO_PROJ common.ChannelSocket DEBUG     T-59219    Accepted 
socket Socket[addr=/194.40.39.77,port=16058,localport=9000] 
20040122:085122.547 LFFM01 NO_PROJ JK                   INFO      T-12985263 
org.apache.jk.common.ChannelSocket: connection timeout reached 

                        -> The request is only processed further when the connection 
timeout is received ...

20040122:085122.550 LFFM01 NO_PROJ JK                   DEBUG     T-12985263 
org.apache.jk.common.ChannelSocket: receive()  
20040122:085122.551 LFFM01 NO_PROJ JK                   DEBUG     T-12985263 
org.apache.jk.common.ChannelSocket: read() [EMAIL PROTECTED] 8192 0 4 = 4 


When I set the connection timeout to 20000000 I never will get something back.
(I tried it also with a connection timeout with -1 and also I got nothing back.)
As you would certainly agree I did not generate heavy load (even if I worked with a 
maximal thread number of three,
I did only sequential requests).

So what do you think?

Cheers Karin




-----Original Message-----
From: Bill Barker [mailto:[EMAIL PROTECTED]
Sent: Donnerstag, 22. Januar 2004 04:28
To: [EMAIL PROTECTED]
Subject: Re: connectionTimeout


connectionTimeout="-1" (or channelSocket.soTimeout=-1 in jk2.properties)
disables it.

The reason that the socket isn't closed on each request is to avoid the cost
of setting up and tearing down sockets.  By leaving it open, the Apache
child can just send the next request that gets handed to it down the same
open socket.  It's the same reasoning as the HTTP/1.1 keep-alive, except
that since the Apache <--> Tomcat socket has nothing to do with the browser
<--> Apache socket, there isn't a reason to close it.

"Krause Karin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> thanx for your answer (again )
>
> As far as I know I cannot disable the connectionTimeout.
> The connectionTimeout I mean here is a property of the CoyoteConnector
> (and if not set the default value is 60 sec). What I do not understand is,
> why the socket is not free again after the response is sent back to the
client.
> Tomcat can only accept new requests if the socket is removed (and it is
removed
> when the connectionTimeout is reached).
>
> Cheers Karin
>
> -----Original Message-----
> From: Bill Barker [mailto:[EMAIL PROTECTED]
> Sent: Mittwoch, 21. Januar 2004 10:34
> To: [EMAIL PROTECTED]
> Subject: Re: connectionTimeout
>
>
>
> "Krause Karin" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > > Hi everybody,
> > > I have a question regarding the configuration/behaviour of the
> org.apache.coyote.tomcat4.CoyoteConnector (Tomcat 4.1.27).
> > I use Tomcat together with Apache (over mod_jk).
> > When I set the connectionTimeout to a very high value (for example 5
> hours) and the maxProcessors to a very
> > low value (for example 3) I can see the following behaviour. I can only
> make 2 requests,
> > than tomcat complains
> > org.apache.tomcat.util.threads.ThreadPool: All threads are busy,
waiting.
> Please increase maxThreads or check the servlet status3 3
>
> Yup.  In the normal state, the 'maxProcessors' should be at least as big
as
> the number of Apache children.  Also, 'connectionTimeout' should usually
be
> disabled (although on a few Linux systems, I've had problems doing this).
> There is a one-to-one mapping from Apache children to Tomcat socket
> connections.  If Apache launches one more child than Tomact can handle,
you
> will see the results as below.
>
> > No more requests can be performed until a restart.
> > Does this mean a connection (socket) is as long occupied as long the
> connectionTimeout is set (even if the response was already sent back to
the
> browser)?
> > I had expected that even if the set connectiontimeout is high, the
socket
> should be given free when the response is sent back to the client.
> > I observed the Tomcat process by means of lsof and saw that the tomcat
> process has opened 3 sockets to apache.
> > When I set a connectionTimeout to a low value (for example 15 sec) the
> error above (all threads are busy) does not appear any more.
> > The lsof command shows that sockets are regulary removed and build
again.
> I debug the Tomcat code and saw that the socket is
> > closed when the timeout occurs. I had expected another behaviour. I mean
> that not every time a new socket is established from Tomcat
> > to apache but sockets are reused.
> >
> > Thanx for any help
> > Karin
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to