hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: 4.1.2 http client Thread in WAITING state on getEntryBlocking
Date Mon, 26 Sep 2011 19:06:46 GMT
On Mon, 2011-09-26 at 09:04 -0700, Mohit Anchlia wrote:
> I am using 4.1.2 and trying to figure out why my threads are all
> waiting on this block. I have this code:
> 

That's because your code is leaking connections.

Oleg 

> Can someone please help?
> 
> 	static {
> 		cm.setMaxTotal(NO_CONN*2);
> 		cm.setDefaultMaxPerRoute(NO_CONN);
> 	}
> 
> 	private static ThreadSafeClientConnManager cm = new
> ThreadSafeClientConnManager();
> 
> 	private static HttpClient httpclient = new DefaultHttpClient(cm);
> 
> 
> 			StringEntity stringEntity = new StringEntity(data, HTTP.UTF_8);
> 
> 			httpput.setEntity(stringEntity);
> 
> 			HttpResponse response = httpclient.execute(httpput);
> 
> 
> "pool-1-thread-24" prio=10 tid=0x00002aaab4018000 nid=0x20df waiting
> on condition [0x00000000446f7000]
>    java.lang.Thread.State: WAITING (parking)
>         at sun.misc.Unsafe.park(Native Method)
>         - parking to wait for  <0x000000061d5866f0> (a
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
>         at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
>         at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1987)
>         at org.apache.http.impl.conn.tsccm.WaitingThread.await(WaitingThread.java:158)
>         at org.apache.http.impl.conn.tsccm.ConnPoolByRoute.getEntryBlocking(ConnPoolByRoute.java:403)
>         at org.apache.http.impl.conn.tsccm.ConnPoolByRoute$1.getPoolEntry(ConnPoolByRoute.java:300)
>         at org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager$1.getConnection(ThreadSafeClientConnManager.java:224)
>         at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:401)
>         at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
>         at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
>         at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:732)
>         at com.intuit.gluster.stress.ClientPost.doPut(ClientPost.java:135)
>         at com.intuit.gluster.stress.InsertHttpCommand.call(InsertHttpCommand.java:142)
>         at com.intuit.gluster.stress.InsertHttpCommand.call(InsertHttpCommand.java:1)
>         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>         at java.lang.Thread.run(Thread.java:662)
> 
> 
> jars in my classpath:
> 
> 
> ls -ltr jars
> total 1572
> -rwx------ 1 root root  60686 Jan 21  2011 commons-logging-1.1.1.jar
> -rwx------ 1 root root  58160 Jan 21  2011 commons-codec-1.4.jar
> -rwx------ 1 root root 181200 Jul 10 12:02 httpcore-4.1.2.jar
> -rwx------ 1 root root 261809 Jul 21 11:58 commons-lang-2.4.jar
> -rwx------ 1 root root  25496 Jul 21 11:58 slf4j-api-1.6.1.jar
> -rwx------ 1 root root 481535 Jul 21 11:58 log4j-1.2.16.jar
> -rwx------ 1 root root   9753 Jul 21 11:58 slf4j-log4j12-1.6.1.jar
> -rwx------ 1 root root 105799 Jul 29 22:54 httpclient-cache-4.1.2.jar
> -rwx------ 1 root root 352254 Jul 29 22:54 httpclient-4.1.2.jar
> -rwx------ 1 root root  26890 Jul 29 22:54 httpmime-4.1.2.jar
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message