I have an application that does nontrivial loading of thumbnails and other resources from a remote service.
I use one instance of DefaultHttpClient and a custom class that I wrote that schedules all my downloads. All downloads are performed sequentially through background threads through AsyncTask. I do not restart my boot program until onPostExecute runs in AsyncTask.
This often works great. If I queue up 20 images, my planner will do just fine. However, I encounter cases where the procedure simply lingers at the client.execute call point (where the client is my instance of DefaultHttpClient). I can inexplicably reanimate the process by moving around the application and doing random actions (scrolling through the list, moving back and forth between actions, etc.). It is as if something I am doing is sending a wake up message to a thread that has reached a dead end or has reached an impasse.
I have added a disgusting amount of logging in all moving parts of my application to see if something external to this procedure causes some kind of deadlock condition. I look at LogCat with pid to find out if something else is happening in my process at the time of stopping or at the time of resuming, and I don't see anything normal. The strangest thing about this is that I can duplicate the exact state again and again.
FWIW, I set connection timeouts and timeouts for both the HttpClient instance and the HttpGet instance that I pass to the execute method. This does not cause the execute method to return earlier or to throw an exception or something like that. When the procedure goes back, HttpClient.execute returns a valid HttpResponse, and everything works as usual.
, , , ? , , - DefaultHttpClient HTTP- Android ?
!