I've run into a similar issue which was solved by making sure to always call consumeContent on the HttpEntity contained in the HttpResponse object (regardless of the response code). HttpClient tries to use keep-alive; if you don't consume every request before they are returned to the ThreadSafeClientConnManager, you're left with an open connection that isn't expecting to service a new request.
If you *really* wanted to, you could grab the ClientConnectionManager from the DefaultHttpClient and call closeIdleConnections. I highly suggest that you attempt to properly consume HttpEntity objects before using closeIdleConnections though. Ernest Woo Woo Games http://www.woogames.com On Nov 14, 5:37 pm, Eurig Jones <[email protected]> wrote: > I'm having an issue with the HttpClient. It is throwing this exception > quite consistently after 3 requests to the same location... > > 11-14 22:27:37.299: INFO/ > chesspresso.client.android.net.HttpCall(29152): fetch() sending failed > to url http://...<myUrl>... > 11-14 22:27:37.299: INFO/ > chesspresso.client.android.net.HttpCall(29152): > org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting > for connection > 11-14 22:27:37.299: INFO/ > chesspresso.client.android.net.HttpCall(29152): at > org.apache.http.impl.conn.tsccm.ConnPoolByRoute.getEntryBlocking(ConnPoolByRoute.java: > 353) > 11-14 22:27:37.299: INFO/ > chesspresso.client.android.net.HttpCall(29152): at > org.apache.http.impl.conn.tsccm.ConnPoolByRoute > $1.getPoolEntry(ConnPoolByRoute.java:238) > 11-14 22:27:37.299: INFO/ > chesspresso.client.android.net.HttpCall(29152): at > org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager > $1.getConnection(ThreadSafeClientConnManager.java:175) > 11-14 22:27:37.299: INFO/ > chesspresso.client.android.net.HttpCall(29152): at > org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java: > 325) > 11-14 22:27:37.299: INFO/ > chesspresso.client.android.net.HttpCall(29152): at > org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java: > 555) > 11-14 22:27:37.299: INFO/ > chesspresso.client.android.net.HttpCall(29152): at > org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java: > 487) > 11-14 22:27:37.299: INFO/ > chesspresso.client.android.net.HttpCall(29152): at > org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java: > 465) > 11-14 22:27:37.299: INFO/ > chesspresso.client.android.net.HttpCall(29152): at > chesspresso.client.android.net.HttpCall.fetch(HttpCall.java:111) > 11-14 22:27:37.299: INFO/ > chesspresso.client.android.net.HttpCall(29152): at > chesspresso.client.android.net.HttpCall.fetch(HttpCall.java:132) > 11-14 22:27:37.299: INFO/ > chesspresso.client.android.net.HttpCall(29152): at > chesspresso.client.android.net.HttpCall.post(HttpCall.java:102) > 11-14 22:27:37.299: INFO/ > chesspresso.client.android.net.HttpCall(29152): at > chesspresso.client.android.net.ServerCall.registerGoogle(ServerCall.java: > 91) > 11-14 22:27:37.299: INFO/ > chesspresso.client.android.net.HttpCall(29152): at > chesspresso.client.android.activity.RegisterGActivity > $RegisterTask.doInBackground(RegisterGActivity.java:201) > 11-14 22:27:37.299: INFO/ > chesspresso.client.android.net.HttpCall(29152): at > chesspresso.client.android.activity.RegisterGActivity > $RegisterTask.doInBackground(RegisterGActivity.java:1) > 11-14 22:27:37.299: INFO/ > chesspresso.client.android.net.HttpCall(29152): at > android.os.AsyncTask$2.call(AsyncTask.java:185) > 11-14 22:27:37.299: INFO/ > chesspresso.client.android.net.HttpCall(29152): at > java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) > 11-14 22:27:37.299: INFO/ > chesspresso.client.android.net.HttpCall(29152): at > java.util.concurrent.FutureTask.run(FutureTask.java:137) > 11-14 22:27:37.299: INFO/ > chesspresso.client.android.net.HttpCall(29152): at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java: > 1068) > 11-14 22:27:37.299: INFO/ > chesspresso.client.android.net.HttpCall(29152): at > java.util.concurrent.ThreadPoolExecutor > $Worker.run(ThreadPoolExecutor.java:561) > 11-14 22:27:37.299: INFO/ > chesspresso.client.android.net.HttpCall(29152): at > java.lang.Thread.run(Thread.java:1096) > > Max connections seems to be 20 in my connection manager. > > Here is my HttpClient creation code... > > ... > private static DefaultHttpClient httpClient; > > static > { > HttpParams params = new BasicHttpParams(); > HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1); > > SchemeRegistry schemeRegistry = new SchemeRegistry(); > schemeRegistry.register(new Scheme("http", > PlainSocketFactory.getSocketFactory(), 80)); > > HttpConnectionParams.setConnectionTimeout(params, > ClientConfig.P_DEFAULT_CONN_TIMEOUT); > HttpConnectionParams.setSoTimeout(params, > ClientConfig.P_DEFAULT_CONN_TIMEOUT); > ConnManagerParams.setTimeout(params, > ClientConfig.P_DEFAULT_CONN_TIMEOUT); > > httpClient = new DefaultHttpClient(new > ThreadSafeClientConnManager(params, schemeRegistry), params);} > > ... > > I noticed that a few users of Axis2 framework have reported very > similar symptoms again after 3 requests to the same url. Axis2 uses > Apache HttpClient under the bonnet also. > > Has anyone experienced a similar issue? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

