question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Connecttimeout not honored

See original GitHub issue

We 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:closed
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
peterdkcommented, Aug 5, 2019

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.

0reactions
peterdkcommented, Aug 5, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found