0

enter image description here

https://i.stack.imgur.com/2jZOf.png

Ok here is the image from wireshark showing the problem. I am calling the service from android .It happens randomly usually if you let the device for some time . Sometimes it recovers sometimes not .You need to retry several times. Seems that connections are from pool of OkHttp .Is there any solution for this ? I tried https://stackoverflow.com/a/2475155 but didnt help. Any idea how to solve it ? Note: other clients work fine during these tcp retransmittions.

Community
  • 1
  • 1
GorillaApe
  • 3,611
  • 10
  • 63
  • 106

1 Answers1

1

It looks like the connection pool isn't timing out bad connections aggressively enough. You'll see a degradation in performance, but you could try disabling OkHttp's connection pool. Put this somewhere in your code to shrink the idle time to 5 seconds

System.setProperty("http.keepAliveDuration", "5000");

I'm interested to help you work this out. My guess is that the server is dropping the connection, but the device isn't tracking that and so the pooled connection fails.

Jesse Wilson
  • 39,078
  • 8
  • 121
  • 128
  • yes my guess is that. However using a remote server this doesnt happen.I tried with lower tcp keepalive not that property and it stuck for 1-2 sec max.However wifi connection is unreliable ,should this happen ?Degradation is big and at ios there isnt that problem. The strange thing is that it happens at my local server.It is already 5000 – GorillaApe Jan 13 '14 at 12:54