Connecttimeout not honored
See original GitHub issueWe are experiencing issues with the OkHTTP connect timeout not being honored on a Pixel 3 device on Android 9. We set it to 10 seconds in the builder, and when using that OkHTTP client and enabling AirPlane Mode, the request we issue will just hang forever.
private static OkHttpClient client = new OkHttpClient.Builder().connectTimeout(10, TimeUnit.SECONDS).build();
[..]
Response response = client.newCall(request).execute();
//Should continue here after 10s, but keeps hanging at this point.
if (response.body() != null) {
//do something
}
The weird thing is, it works ok with other devices, also on Android 9, and the emulator. The issue happens when in AirPlane mode, but also when just having no mobile network in a building.
I tried testing the app with OkHTTP 4.0.1, 3.14.2, 3.12.1 and 3.4.1, all exhibit the same issue.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7
Top Results From Across the Web
PK75575: COM.IBM.CORBA.CONNECTTIMEOUT NOT ...
PK75575: COM.IBM.CORBA.CONNECTTIMEOUT NOT HONORED WHEN SSL CONNECTION IS BEING USED FOR OUTBOUND ORB CONNECTION. Fixes are available.
Read more >Why is ConnectTimeout Ignored In This Case? - Stack Overflow
BTW, I ran a BID trace (which is not easy to set up!) And noticed that it tried both TCP/IP and Named Pipes...
Read more >connect-timeout not honored when custom address-provider ...
The .NET class (implementing Tangosol.Net.IAddressProvider) currently resolves to a single address - 127.0.0.1:9101. This address is invalid and ...
Read more >curl max-time and connect-timeout not working at all
Without seeing your curl --version let me take a stab in the dark based on just running into this exact problem. Is your...
Read more >ConnectTimeout=2 not working for me - Google Groups
something is wrong with the remote host. If the remote host is down (non-pingable) or sshd is down the timeout option works and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It might be related to a VPN service we use, we discovered. But still, it’s weird that the connection timeout is not enforced always somehow.
Ah ok, I understand now. OkHTTP connects to the VPN socket, to the connect timeout is not triggered. But the VPN internally just doesn’t give a proper error, until after 5 minutes or so. That’s indeed then not a OkHTTP issue.