-
Notifications
You must be signed in to change notification settings - Fork 9.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SocketTimeoutException with OkHttp 2.0.0 + Retrofit 1.6.1 #1037
Comments
Got a full stack trace? That'll help us to identify whether it's a recycled connection or a new one. |
Here is a full stack trace for 3 requests. URLs have been masked due to private API.
|
I'm getting the same exception with the same lib versions + okio_1.0.0 and okhttp-urlconnection_2.0.0. The stacktrace is the same. It is happening on Android 4.1, 4.2 and 4.4. I'm ready to help as needed because this issue is stopping me from releasing an app. Edit: I'm sending requests over HTTPS but the Exception is thrown both on HTTP and HTTPS. Edit2: I've removed okhttp, okhttp_urlconnection and okio from my project and made some tests on Nexus 4 running stock Android 4.4.4 and I was still getting the SocketTimeoutException. I don't know exactly which version of okhttp is built into 4.4.4 but the issue is present there as well. |
Probably the issue is not in okhttp. I managed to get my hands on a Samsung Galaxy S2 running Android 4.0.3 and tested it with Retrofit + HttpUrlConnection like this:
and I keep getting the SocketTimeoutException on random. I guess that the issue is not in OkHttp as the Galaxy S2 is not supported by OkHttp as far as I can see in the logs. This makes me think that the issue is either in Retrofit or some of the libraries in my project is causing all the issues. |
I am getting the same issue. with the same stack trace. I was getting the timeout exception (on wifi networks only and randomly) on the loopj library built on apache aysnc. Which was the reason I am migrating to okhttp. I am beginning to think, this is not a issue with okhttp. Attached are both stack traces. From my older library (loopJ)
and from the okhttp request
|
Possibly due to connection reuse + networks on the device changing. For example, going from WiFi to 3G. We've got some changes coming that will detect network changes and evict connections from the pool. |
It's not from connection changes, at least not in my case - the devices are connected to WiFi in the office. |
No clear action to take on this. |
@Zhelyazko's solution worked. You need to disable |
Solution details address:http://www.jianshu.com/p/dde236d7211d |
Hello. I've been getting SocketTimeoutException intermittently. This is not an Internet connection issue. If I access the same link from the phone's browser it will open.
It happens mostly on WiFi, but it happens on mobile data also from time to time. After a random number of calls (usually below 20), the timeout occurs and any subsequent call will have the same result. It recovers after a while and works for another 20 calls or so. I cannot get an exact pattern or reason why this happens.
The endpoint is not blocking the app, tested with the backend guys.
Any help will be greatly appreciated.
retrofit.RetrofitError: failed to connect to api.xyz.ro/89.xx.yy.37 (port 80) after 15000ms
The text was updated successfully, but these errors were encountered: