我遇到了这样一个奇怪的问题。
我们使用一个线程通过http将某些东西刷新到服务器。有时线程似乎停留在从套接字中回收数据。
下面的jstack:
"zipkin-flush-1" #21 daemon prio=10 os_prio=0 tid=0x00007f67f3e64000 nid=0x8b2 runnable [0x00007f67c5ed9000]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:171)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
- locked <0x000000008ab3bff0> (a java.io.BufferedInputStream)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:735)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1569)
- locked <0x00000000896148b0> (a sun.net.www.protocol.http.HttpURLConnection)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
- locked <0x00000000896148b0>; (a sun.net.www.protocol.http.HttpURLConnection)
我使用netstat来监控客户端的套接字状态,如下所示。
tcp 0 0 ::ffff:10.X.X.X:42953 ::ffff:10.X.X.X:9441 ESTABLISHED 2099/java
好吧,如果我在服务器端做同样的事情,那就什么都没有显示
我无法理解这种情况是如何发生的,任何解释都会受到赞赏。非常感谢。