tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henri Gomez <hgo...@apache.org>
Subject AJP13 problem on Tomcat 4.1.15
Date Wed, 20 Nov 2002 08:29:34 GMT
While playing with 4.1.15, I discovered some nasty problem with the 
AJP13 implementation from JTC.

1) TC 4.1.15 set socket timeout (20000 = 20s) which make give you
    Read exception after 20s of inactivity between webserver and Tomcat :

90577 [Thread-6] ERROR common.ChannelSocket  - Error, closing connection
java.io.InterruptedIOException: Read timed out
	at java.net.SocketInputStream.socketRead(Native Method)
	at java.net.SocketInputStream.read(SocketInputStream.java:113)
	at java.io.BufferedInputStream.fill(BufferedInputStream.java:202)
	at java.io.BufferedInputStream.read1(BufferedInputStream.java:241)
	at java.io.BufferedInputStream.read(BufferedInputStream.java:296)
	at org.apache.jk.common.ChannelSocket.read(ChannelSocket.java:487)
	at org.apache.jk.common.ChannelSocket.receive(ChannelSocket.java:425)
	at 
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:540)
	at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:654)
	at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
	at java.lang.Thread.run(Thread.java:512)

The problem is that the socket is NOT close at that time and even if TC
free the thread, the socket still exists and make webserver think that 
it could send request (and sus wait forever replies !!!!)

I'll commit a patch to make the socket close in a finally area.

2) The second problem is related to the socket timeout settings.
    In Ajp13 protocol, the webserver decide when it had to close
    the socket since it's the client (initiator) of the connection.
    if tomcat close the socket, the webserver won't detect before it will
    try to read replies. It's a known problem with Sockets implementation
    which make that write() calls on a half-closed connection DIDN'T
    return error CODE, only read() calls with report the error that the
    remote decided to close the connection.

As such I strongly recommand to disable the connectionTime by removing 
the connectionTimeout in server.xml :

     <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
     <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
                port="8009" minProcessors="5" maxProcessors="75"
                enableLookups="true" redirectPort="8443"
                acceptCount="10" debug="0" connectionTimeout="0"
                useURIValidationHack="false"
 
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>


You should know that mod_jk 1.2.0 (don't know for latest 2.0.x),
have settings now which make webserver close unused sockets after
some time, just to be sure that the tomcat didn't have TOO many unused 
threads.

3) I saw that linger are set to 100, which is not recommanded in
Regards.



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


Mime
View raw message