我应该从哪里开始调查 SocketTimeoutException:读取超时
我时不时地在日志中看到以下堆栈跟踪,其中,套接字超时尝试从另一台服务器访问内容。我的问题是,对于在 Linux 上的 Weblogic 上运行的 J2EE 应用程序,我应该检查哪些配置设置?我专门寻找以下内容。HttpClient
text/script
- JVM 超时参数
-
HttpClient
参数 - Weblogic 超时参数或任何其他配置,如线程数等。
- J2EE 应用程序设置,如 servlet 配置等。
- 操作系统资源,如线程、文件处理程序和 cpu
- 可能影响套接字连接的任何其他配置设置
- 线程转储会有帮助吗?
这是我的代码
HTTPResponse httpClientResponse;
//do some stuff
httpClientResponse.getStatusCode(); // this is where it fails
这是堆栈跟踪
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)
谢谢
我将用下面的调查结果更新我的问题。
- 没有设置显式超时,这意味着服务器的 http 会话超时可能会生效。
HttpClient
-
SO_TIMEOUT
for 为 0,这意味着它应该无限期等待。HttpClient