title: java.net.SocketTimeoutException: Read timed out under Tomcat
body: <p>I have a Tomcat based web application. I am intermittently getting the following exception,</p>
  <pre><code>Caused by: java.net.SocketTimeoutException: Read timed out
      at java.net.SocketInputStream.socketRead0(Native Method)
      at java.net.SocketInputStream.read(SocketInputStream.java:150)
      at java.net.SocketInputStream.read(SocketInputStream.java:121)
      at org.apache.coyote.http11.InternalInputBuffer.fill(InternalInputBuffer.java:532)
      at org.apache.coyote.http11.InternalInputBuffer.fill(InternalInputBuffer.java:501)
      at org.apache.coyote.http11.InternalInputBuffer$InputStreamInputBuffer.doRead(InternalInputBuffer.java:563)
      at org.apache.coyote.http11.filters.IdentityInputFilter.doRead(IdentityInputFilter.java:124)
      at org.apache.coyote.http11.AbstractInputBuffer.doRead(AbstractInputBuffer.java:346)
      at org.apache.coyote.Request.doRead(Request.java:422)
      at org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:290)
      at org.apache.tomcat.util.buf.ByteChunk.substract(ByteChunk.java:431)
      at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:315)
      at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:200)
      at java.nio.channels.Channels$ReadableByteChannelImpl.read(Channels.java:385)
  </code></pre>
  <p>Unfortunately I don't have access to the client, so I am just trying to confirm on various reasons this can happen,</p>
  <ol>
  <li><p>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.</p>
  </li>
  <li><p>Client has a read timeout set, and server is taking longer than that to respond.</p>
  </li>
  <li><p>One of the threads I went through, said this can happen with high concurrency and if the keepalive is enabled.</p>
  </li>
  </ol>
  <p>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.</p>
  <p>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.</p>