You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Pawel Veselov <pa...@gmail.com> on 2022/11/04 11:45:34 UTC

Tomcat 9x NIO connector socket timeout

Hello.

I was wondering what exact value does Tomcat 9x use for NIO connector
socket timeouts?
I.e., when the following exception occurs:

org.apache.catalina.connector.ClientAbortException
java.net.SocketTimeoutException
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:353)
at org.apache.catalina.connector.OutputBuffer.flushByteBuffer(OutputBuffer.java:783)
at org.apache.catalina.connector.OutputBuffer.append(OutputBuffer.java:688)
at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:388)
at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:366)
at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:96)

, it means that the underlying socket's .setSoTimeout() has been set
to a positive value.

Reading https://tomcat.apache.org/tomcat-9.0-doc/config/http.html, I see:

socket.soTimeout - "This is equivalent to standard attribute
connectionTimeout". Does it mean that setting this property is the
same as setting connectionTimeout, or that in the absence of
socket.soTimeout being explicitly set, the value of connectionTimeout
is used?

"connectionTimeout" says that it's only about waiting for a request
line after a TCP connection is accepted.

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


Re: Tomcat 9x NIO connector socket timeout

Posted by Mark Thomas <ma...@apache.org>.
connectionTimeout and socket.soTimeout are the same attribute. The value 
used is the most recent one set regardless of which setter was used.

For the simple case of blocking read/write then the default timeout will 
be the same as connectionTimeout.

Once you get into async, WebSocket and HTTP/2 things get more complex. 
For example, the socket timeout for async is infinite and Tomcat manages 
the async timeout separately.

The docs could do with an update.

Mark


On 04/11/2022 11:45, Pawel Veselov wrote:
> Hello.
> 
> I was wondering what exact value does Tomcat 9x use for NIO connector
> socket timeouts?
> I.e., when the following exception occurs:
> 
> org.apache.catalina.connector.ClientAbortException
> java.net.SocketTimeoutException
> at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:353)
> at org.apache.catalina.connector.OutputBuffer.flushByteBuffer(OutputBuffer.java:783)
> at org.apache.catalina.connector.OutputBuffer.append(OutputBuffer.java:688)
> at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:388)
> at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:366)
> at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:96)
> 
> , it means that the underlying socket's .setSoTimeout() has been set
> to a positive value.
> 
> Reading https://tomcat.apache.org/tomcat-9.0-doc/config/http.html, I see:
> 
> socket.soTimeout - "This is equivalent to standard attribute
> connectionTimeout". Does it mean that setting this property is the
> same as setting connectionTimeout, or that in the absence of
> socket.soTimeout being explicitly set, the value of connectionTimeout
> is used?
> 
> "connectionTimeout" says that it's only about waiting for a request
> line after a TCP connection is accepted.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

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