GorillaApe
GorillaApe

Reputation: 3641

WCF REST tcp errors

enter image description here

https://i.sstatic.net/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.

Upvotes: 0

Views: 106

Answers (1)

Jesse Wilson
Jesse Wilson

Reputation: 40623

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.

Upvotes: 1

Related Questions