Hi, I can't figure out why my code to fetch an HTTP resource hangs in EntityUtils.toString().
I'm running Java 6 with HttpClient 4.3.5. I had been using code like this to reload a Guava cache. It was working for about a year twice / minute, but recently, my cache stopped reloading reliably and EntityUtils.toString() started to hang after ~10-1000 requests. I tried updating from 4.1.2 (which had been working) to 4.3.5, but that didn't help. My code looks like this: HttpEntity entity = null; try { entity = PooledHttpClient.getHttpEntity(new HttpGet(location)); // PROBLEM HERE: Deadlock occurs rarely in EntityUtils.toString() final String resource = EntityUtils.toString(entity); return resource; } catch (Exception e) { // Something went wrong, log the error or retry } finally { EntityUtils.consume(entity); } Here's where it's getting stuck: java.lang.Thread.State: RUNNABLE at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:129) at org.apache.http.impl.io.AbstractSessionInputBuffer.read(AbstractSessionInputBuffer.java:198) at org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:178) at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:137) at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264) at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158) - locked <0x000000008a259028> (a java.io.InputStreamReader) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.Reader.read(Reader.java:123) at org.apache.http.util.EntityUtils.toString(EntityUtils.java:244) at org.apache.http.util.EntityUtils.toString(EntityUtils.java:288) at com.x.template.Resource.getResource(Resource.java:217) I still haven't run into an issue on my dev machine on OS X, but production is running on Joyent's SmartOS (Intel Solaris). I'm pretty stumped, any help would be GREATLY APPRECIATED! Thanks, Jon --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org