socketRead0 time out problem
Bernd Eckenfels
bernd-2014 at eckenfels.net
Fri Apr 18 03:09:08 UTC 2014
Hm,
hard to say. Did you use tcpdump to check if data is transfered or
did you straced the java process? And you can check more socket stats
with /sbin/ss -eomipt
Bernd
Am Fri, 18 Apr 2014 09:23:21 +0800
schrieb Li Li <fancyerii at gmail.com>:
> hi all
> sorry to post a not-dev problem here. because I can't find any
> active forum(few people use oracle's Networking now).
>
> I am using http client 4.3. I use
> PoolingHttpClientConnectionManager with many threads.
> but I found one thread hangs on socketRead0(other thread is correct)
>
> netstat -anotp|grep 5872
> (Not all processes could be identified, non-owned process info
> will not be shown, you would have to be root to see it all.)
> tcp 0 0 192.168.11.181:35251 192.168.11.169:61616
> ESTABLISHED 5872/java off (0.00/0/0)
> tcp 0 0 192.168.11.181:35252 192.168.11.169:61616
> ESTABLISHED 5872/java off (0.00/0/0)
> tcp 0 0 49.4.132.244:56035 221.204.231.139:80
> ESTABLISHED 5872/java off (0.00/0/0)
> tcp 0 0 192.168.11.181:41935 192.168.11.151:2181
> ESTABLISHED 5872/java off (0.00/0/0)
>
> java stack:
> "Thread-51" prio=10 tid=0x00007f7dfc20d800 nid=0x1846 runnable
> [0x00007f7d5c5c4000]
> java.lang.Thread.State: RUNNABLE
> at java.net.SocketInputStream.socketRead0(Native Method)
> at java.net.SocketInputStream.read(SocketInputStream.java:152)
> at java.net.SocketInputStream.read(SocketInputStream.java:122)
> at
> org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:136)
> at
> org.apache.http.impl.io.SessionInputBufferImpl.read(SessionInputBufferImpl.java:195)
> at
> org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:178)
> at
> org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:200)
> at
> org.apache.http.impl.io.ContentLengthInputStream.close(ContentLengthInputStream.java:103)
> at
> org.apache.http.impl.execchain.ResponseEntityWrapper.streamClosed(ResponseEntityWrapper.java:120)
> at
> org.apache.http.conn.EofSensorInputStream.checkClose(EofSensorInputStream.java:227)
> at
> org.apache.http.conn.EofSensorInputStream.close(EofSensorInputStream.java:174)
> at org.apache.http.util.EntityUtils.consume(EntityUtils.java:88) at
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:222)
> at
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:160)
> at
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:136)
> at
> com.founder.httpclientfetcher.HttpClientFetcher.httpGet(HttpClientFetcher.java:464)
>
> I have asked this question in httpclient mailing list and get
> this answer: Assuming that this.getReadTimeout() returns a positive
> value, the read operation can still block indefinitely if the server
> keeps on sending packets often enough to prevent the operation from
> exceeding the socket timeout value.
> And I also goolged a stackover question:
> http://stackoverflow.com/questions/15874834/httpclient-hangs-on-socketread0-with-successfully-executed-method
>
> I have all the timeouts setup just fine but I found out we have on url
> that does http chunking but sends no results(works fine in chrome, but
> in http client it hangs forever even with the timeout set). Luckily I
> own the server and just return some garbage and it no longer hangs.
> This seems like a very unique bug in that http client does not handle
> some kind of empty chunking case well(though I could be way off)....I
> just know it hangs every time on that same url with empty data and
> that url is http chunking csv download back to our http client.
>
> is this reason causing my thread hang?
> any solution for this?
More information about the net-dev
mailing list