You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When too many request(upto 10 tested) sent simultaneously for binary data with BinaryResponseHttpResponseHandler and 404 (Not found) response from server; Then any other http request serving by AsyncHttpResponseHandler got ConnectionPoolTimeoutException. Seems, connection is not closing incase of error/404 response, cause pool overflow.
Here, is the exception:
java.net.ConnectException
at com.loopj.android.http.AsyncHttpRequest.makeRequestWithRetries(AsyncHttpRequest.java:126)
at com.loopj.android.http.AsyncHttpRequest.run(AsyncHttpRequest.java:57)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:444)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
at java.lang.Thread.run(Thread.java:1027)
Caused by: org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection
at org.apache.http.impl.conn.tsccm.ConnPoolByRoute.getEntryBlocking(ConnPoolByRoute.java:353)
at org.apache.http.impl.conn.tsccm.ConnPoolByRoute$1.getPoolEntry(ConnPoolByRoute.java:238)
at org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager$1.getConnection(ThreadSafeClientConnManager.java:175)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:325)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
at com.loopj.android.http.AsyncHttpRequest.makeRequest(AsyncHttpRequest.java:76)
at com.loopj.android.http.AsyncHttpRequest.makeRequestWithRetries(AsyncHttpRequest.java:95)
... 7 more
The text was updated successfully, but these errors were encountered:
I can figure out the problem and found solution.
BinaryHttpResponseHandler by default only allow "image/jpeg", "image/png" content type, and ABORT processing response if Content-Type is not so ( jpg or png). So, if server return 404 status with content type of html/json incase of image not found, it cause connection still open for certain period of time and cause ConnectionPoolTimeoutException when there are many request sent simultaneously.
In my case, server would return 404 with json response incase of image not found. So I use
BinaryHttpResponseHandler(String[] allowedContentTypes) constructor and change the mAllowedContentTypes to:
{
"image/jpeg",
"image/png",
"application/json"
} to get rid of this problem.
When too many request(upto 10 tested) sent simultaneously for binary data with BinaryResponseHttpResponseHandler and 404 (Not found) response from server; Then any other http request serving by AsyncHttpResponseHandler got ConnectionPoolTimeoutException. Seems, connection is not closing incase of error/404 response, cause pool overflow.
Here, is the exception:
The text was updated successfully, but these errors were encountered: