Read timed out under Tomcat

I have a Tomcat based web application. I am intermittently getting the following exception,

Caused by: Read timed out
    at Method)
    at org.apache.coyote.http11.InternalInputBuffer.fill(
    at org.apache.coyote.http11.InternalInputBuffer.fill(
    at org.apache.coyote.http11.InternalInputBuffer$InputStreamInputBuffer.doRead(
    at org.apache.coyote.http11.filters.IdentityInputFilter.doRead(
    at org.apache.coyote.http11.AbstractInputBuffer.doRead(
    at org.apache.coyote.Request.doRead(
    at org.apache.catalina.connector.InputBuffer.realReadBytes(
    at org.apache.tomcat.util.buf.ByteChunk.substract(
    at java.nio.channels.Channels$

Unfortunately I don’t have access to the client, so I am just trying to confirm on various reasons this can happen,

  1. Server is trying to read data from the request, but its taking longer than the timeout value for the data to arrive from the client. Timeout here would typically be Tomcat connector → connectionTimeout attribute.
  2. Client has a read timeout set, and server is taking longer than that to respond.
  3. One of the threads I went through, said this can happen with high concurrency and if the keepalive is enabled.

For #1, the initial value I had set was 20 sec, I have bumped this up to 60sec, will test, and see if there are any changes.

Meanwhile, if any of you guys can provide you expert opinion on this, that’l be really helpful. Or for that matter any other reason you can think of which might cause this issue.

Leave a Comment