tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From William Leung <>
Subject soTimeout not worked on channelNioSocket
Date Mon, 08 Oct 2007 07:07:44 GMT

I have configuared tomcat to use the NIO impl over AJP, here are the lines in
    <Connector address="" port="0"


               redirectPort="8443" protocol="AJP/1.3"

(TC version 5.5.17)
I had setted the soTimeout with 10 minutes, cause I notice such stages in
server status

Stage Time B Sent B Recv Client VHost Request 
S 33280840 ms 359 KB 0 KB x.x.x.x GET ...

That shows several requests were blocking on reading request bodies for

But unfortunately it dosen't worked for me, I am expecting a request should
only blocking mostly 10 minutes on read, after that a SocketTimeoutException
should raised.

After digest the source code of, I found that
ChannelNioSocket.SocketInputStream just wait infinitly if no data comes
while socket could not be detected closing

        private void block(int len) throws IOException {
            ... ...
            if(!dataAvailable) {
                blocking = true;
                    log.debug("Waiting for "+len+" bytes to be available");
                }catch(InterruptedException iex) {
                blocking = false;
            if(dataAvailable) {
                dataAvailable = false;
                if(fill(len) < 0) {
                    isClosed = true;

The socketTimeout parameter is not used to throw SocketTimeoutException,
actually it has no meaning.

I even read the source for TC 6.0.13, the same as above.

Should it be more precisely that throwing SocketTimeoutException on later
condiction test for (dataAvailable) is not true?

In ChannelSocket implement, the problem is not exists,  it uses blocking
Socket.getInputStream, and it would throws SocketTimeoutException for socket
timeout while Socket.setSoTimeout was called
View this message in context:
Sent from the Tomcat - User mailing list archive at

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message