Thanks ernestw. You're probably right, but I'm going to have a closer look and monitor the connections.
@victor. I've come across the connections per route params as well, and specifying them won't make any difference in this case as that does not effect how the connections are closed. On Nov 18, 9:59 am, viktor <victor.scherb...@gmail.com> wrote: > You also can use next params: > > ConnPerRoute connPerRoute = new > ConnPerRouteBean(CONNECTION_PER_ROUTE); > ConnManagerParams.setMaxConnectionsPerRoute(params, connPerRoute); > > Where CONNECTION_PER_ROUTE is number of simultanious connections to > the same host > > On 18 Лис, 01:13, ernestw <ernest...@gmail.com> wrote: > > > > > > > > > Hmmm. I wouldn't use that solution. With Keep-alive you never > > explicitly close your connections - consumeContent merely reads > > everything in the response input/error stream and connections are > > automatically closed when they are idle. Increasing the maximum > > connections per route only gives you more connections to stall in the > > same way before running into the same problem. It's possible the > > server will timeout and close those connections before you exhaust > > your local connection max but realize you're now tying up somebody > > else's resources. > > > Ernest > > > On Nov 17, 3:05 pm, Eurig Jones <eurigjo...@gmail.com> wrote: > > > > My thinking was - If there is no obvious "close" method anywhere, and > > > all examples I've seen of the HttpClient do not mention a close/finish > > > type method then you would assume that it just handles it for you! > > > > Looks like that is not always the case, at least in a timely fashion. > > > > Thanks ernestw I'll have a look at consumeContent, but I got around > > > the issue another way which I documented in a blog > > > post:http://androidisland.blogspot.com/2010/11/httpclient-and-connectionpo... > > > > Regards, > > > Eurig Jones > > > > On Nov 17, 3:02 pm, ernestw <ernest...@gmail.com> wrote: > > > > > 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 <eurigjo...@gmail.com> 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(ConnPoolBy > > > > > Route.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(DefaultRequestDi > > > > > rector.java: > > > > > 325) > > > > > 11-14 22:27:37.299: INFO/ > > > > > chesspresso.client.android.net.HttpCall(29152): at > > > > > org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.j > > > > > ava: > > > > > 555) > > > > > 11-14 22:27:37.299: INFO/ > > > > > chesspresso.client.android.net.HttpCall(29152): at > > > > > org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.j > > > > > ava: > > > > > 487) > > > > > 11-14 22:27:37.299: INFO/ > > > > > chesspresso.client.android.net.HttpCall(29152): at > > > > > org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.j > > > > > ava: > > > > > 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en