Some Android clients disconnect and then retry HTTP request after 15 seconds, even though timeout is larger -


I have an Android app that makes an HTTP request to a server that I control. This server relay requests to another server, which I do not control and is currently heavily overloaded, to deal with delays in remote server, I have extended all the timeouts, which I know about.

In my own server, I'm seeing some customers (Android app) seconds and then try the same request again, even if I've set up the connection and are getting bigger than that time Have read the timeout.

Nginx reports in my server that the log in the form of 499, and it always occurs about 15 seconds after the arrival of the request.

Using Sterhurck on my server, I have positively verified that this client is disconnecting (sending an FIN packet) and then retrying the request immediately .

I can not reproduce the issue using my phone. Even if I introduce the server to an artificial delay, my phone respects the timeout I have set. On an recent update, I can see a pattern for problematic phones, but I have not seen any pattern so far, some about the user (phone model, Android version, current connection type) Has started sending basic information.

I was using the first HttpClient on the app, and tried several ways to fix this problem, but time was over and I was trying again. Switched to HttpURL Connection , and I see the same behavior code of code HttpURLConnection is really simple, for example almost literally, for different timeout values Save:

  InputStream = Faucet; {URL url = Try the new URL ("my.server.com" + paramString); HttpURLConnection conn = (HttpURLConnection) url.openConnection (); Conn.setReadTimeout (180 * 1000); Conn.setConnectTimeout (30 * 1000); Conn.setRequestMethod ("GET"); Conn.setDoInput (true); Conn.connect (); Int response = conn.getResponseCode (); Is = conn.getInputStream (); }   

I have not mentioned any of this behavior anywhere on the document. Any idea about where this 15-hour time is ending and why my own timeout is not respected?

After seeing myself on this issue, I was able to solve it with the top answer After your request changes will look like the following:

  ... URL url = new URL ("my.server.com" + paramString); System.setProperty ("http.keepAlive", "Wrong"); HttpURLConnection conn = (HttpURLConnection) url.openConnection (); ...    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -