title: Where should I start investigating SocketTimeoutException: Read timed out
body: <p>Every now and then I see following stacktrace in the log in which, <code>HttpClient</code> socket times out trying to access <code>text/script</code> content from another server. My question is what config settings should I check for my J2EE app running on Weblogic, on Linux? I am specifically looking for the following.</p>
  
  <ul>
  <li>JVM timeout params</li>
  <li><code>HttpClient</code> params</li>
  <li>Weblogic timeout params or any other config like number of threads etc.</li>
  <li>J2EE Application settings like servlet config etc.</li>
  <li>Operating system resources like threads, file handlers and cpu</li>
  <li>Any other config settings that might influence the socket connection</li>
  <li>Would thread dumps help?</li>
  </ul>
  
  <p>Here's my code</p>
  
  <pre><code>HTTPResponse httpClientResponse;
  //do some stuff
  httpClientResponse.getStatusCode(); // this is where it fails
  </code></pre>
  
  <p>and this is the stacktrace</p>
  
  <pre><code>java.net.SocketTimeoutException: Read timed out
  at jrockit.net.SocketNativeIO.readBytesPinned(Native Method)
  at jrockit.net.SocketNativeIO.socketRead(SocketNativeIO.java:32)
  at java.net.SocketInputStream.socketRead0(SocketInputStream.java)
  at java.net.SocketInputStream.read(SocketInputStream.java:129)
  at HTTPClient.BufferedInputStream.fillBuff(BufferedInputStream.java:206)
  at HTTPClient.BufferedInputStream.read(BufferedInputStream.java:126)
  at HTTPClient.StreamDemultiplexor.read(StreamDemultiplexor.java:356)
  at HTTPClient.RespInputStream.read(RespInputStream.java:147)
  at HTTPClient.RespInputStream.read(RespInputStream.java:108)
  at HTTPClient.Response.readResponseHeaders(Response.java:1123)
  at HTTPClient.Response.getHeaders(Response.java:846)
  at HTTPClient.Response.getStatusCode(Response.java:331)
  at HTTPClient.RetryModule.responsePhase1Handler(RetryModule.java:92)
  at HTTPClient.HTTPResponse.handleResponseImpl(HTTPResponse.java:872)
  at HTTPClient.HTTPResponse.access$000(HTTPResponse.java:62)
  at HTTPClient.HTTPResponse$2.run(HTTPResponse.java:839)
  at HTTPClient.HTTPResponse$2.run(HTTPResponse.java:837)
  at
  HTTPClient.HttpClientConfiguration.doAction(HttpClientConfiguration.java:666)
  at HTTPClient.HTTPResponse.handleResponse(HTTPResponse.java:837)
  at HTTPClient.HTTPResponse.getStatusCode(HTTPResponse.java:242) 
  </code></pre>
  
  <p>Thanks</p>
  
  <p>I will be updating my question with the FINDINGS below.</p>
  
  <ol>
  <li>There is no explicit timeout set on <code>HttpClient</code> which means that http
  session timeout of the server might be taking an effect.</li>
  <li><code>SO_TIMEOUT</code> for <code>HttpClient</code> is 0 which means that it should wait indefinitely.</li>
  </ol>