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.

DNS resolution failure on Android after connectivity changes

See original GitHub issue

What version of gRPC are you using?

1.9.0

What did you expect to see?

For the grpc channel to be able to handle Android connectivity changes (eg. from wifi to mobile data, or from no data connection to wifi). For the resetConnectBackoff() call on a channel to successfully short-circuit the backoff timer and make it reconnect immediately when triggered from a connectivity change.

What did you do

Built a grpc channel using the OkHttpChannelBuilder. Registered an Android BroadcastReceiver against connectivity changes which calls the channels resetConnectBackoff() (as recommended in #4011).

What did you see instead

The resetConnectBackoff() being called from the broadcast receiver event (for android.net.conn.CONNECTIVITY_CHANGE) and failing to short-circuit the backoff timer. Had to wait approx 60 seconds before the channel became usable again. Reports a host name resolution failure until the 60 seconds passes. A sleep (of a few seconds) between the connectivity change and the resetConnectBackoff() call seems to fix the issue. Is there any way to decrease the default backoff time. It may be a useful feature in situations like this.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
ericgribkoffcommented, Mar 13, 2018

Update: #4105 changes the behavior of the gRPC library to use exponential backoff on dns resolution failures. This fixes the issue reported here, as the channel will recover ~immediately from a momentary failure in the dns resolver. This behavior change is automatic and doesn’t require any user action to enable. The fix is in master now and will be in the upcoming gRPC Java 1.11.0 release.

0reactions
ericgribkoffcommented, Feb 28, 2018

This will be resolved when https://github.com/grpc/grpc-java/pull/4105 is merged.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Discover DNS Server Problems In Android
Open Wi-Fi settings on your Android device; Tap once on your network, and go to Advanced settings; Change IP settings to Static.
Read more >
Local DNS resolution suddenly stopped working...
The phone is connected to my local WiFi and I can see in the WiFi connection details it is getting the right IP...
Read more >
How to Fix Private DNS Server Cannot be Accessed Issue on ...
Steps to Solve Private DNS server Issue on Android · On your phone, open the Settings menu. · Next, tap on Network and...
Read more >
Complete DNS failure after frequent switching between WiFi ...
I run Blokada 5.10.1 from F-Droid on an Android phone (Google ... I recently switched to version 5 after you added “network DNS”...
Read more >
What Is DNS Failure? Common Causes And Solutions - Forbes
A DNS failure occurs when users are unable to connect to an IP address via a domain name. A message will pop up...
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