Skip to content
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

Dns$Companion$DnsSystem.lookup No address associated with hostname #8481

Open
ilkcansaricicek opened this issue Jul 18, 2024 · 4 comments
Open
Labels
bug Bug in existing code

Comments

@ilkcansaricicek
Copy link

ilkcansaricicek commented Jul 18, 2024

Hello,
I published my application on June 12. And this version, I upgraded okhttp library from 4.9.1 to 4.12.0. I am displaying a lot of the following error in try-catch block in firebase. (no changes were made on the server side)
Is there anything I should check?

Thanks

dnsPNG

      Non-fatal Exception: java.lang.Exception: CallbackCreator-getDefaultCallback-onFailure exception detail:Unable to resolve host "xxxxxxx": No address associated with hostname
   at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:156)
   at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:103)
   at java.net.InetAddress.getAllByName(InetAddress.java:1152)
   at okhttp3.Dns$Companion$DnsSystem.lookup(Dns.kt:49)
   at okhttp3.internal.connection.RouteSelector.resetNextInetSocketAddress(RouteSelector.kt:169)
   at okhttp3.internal.connection.RouteSelector.nextProxy(RouteSelector.kt:131)
   at okhttp3.internal.connection.RouteSelector.next(RouteSelector.kt:73)
   at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:205)
   at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106)
   at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74)
   at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.java:255)
   at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32)
   at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
   at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
   at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
   at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
   at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
   at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
   at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
   at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
   at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:517)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
   at java.lang.Thread.run(Thread.java:1012)
@ilkcansaricicek ilkcansaricicek added the bug Bug in existing code label Jul 18, 2024
@MohamadJaara
Copy link

It seems likely that this issue is related to Firebase sending requests while the app is in the background. Some Android OEMs might block the internet connection for apps running in the background. As a result, the system's DNS lookup could cache failed requests, causing the first request after the app returns to the foreground to fail due to the cached DNS entry.

In theory, the failed DNS lookup cache has a TTL of around 2 seconds, so any request made after this period should be fine.

For more context, you can refer to the discussion in this related Retrofit issue: Retrofit issue #3915.

@jricardooliveira
Copy link

jricardooliveira commented Aug 28, 2024

Hi...

Same problem here started 12th July. I think @ilkcansaricicek mean to say July and not June, accordingly to his chart. This is really weird and we're trying to find the root cause of this also but without success.

Take a look at the error that lead to crashes 👍

java.net.UnknownHostException: Unable to resolve host "api.mycompany.com": No address associated with hostname
	at java.net.Inet6AddressImpl.lookupHostByName()(Inet6AddressImpl.java:124)
	at java.net.Inet6AddressImpl.lookupAllHostAddr()(Inet6AddressImpl.java:103)
	at java.net.InetAddress.getAllByName()(InetAddress.java:1152)
	at okhttp3.Dns$Companion$DnsSystem.lookup()(Dns.kt:49)
	at okhttp3.internal.connection.RouteSelector.resetNextInetSocketAddress()(RouteSelector.kt:164)
	at okhttp3.internal.connection.RouteSelector.nextProxy()(RouteSelector.kt:129)
	at okhttp3.internal.connection.RouteSelector.next()(RouteSelector.kt:71)
	at okhttp3.internal.connection.ExchangeFinder.findConnection()(ExchangeFinder.kt:205)
	at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection()(ExchangeFinder.kt:106)
	at okhttp3.internal.connection.ExchangeFinder.find()(ExchangeFinder.kt:74)
	at okhttp3.internal.connection.RealCall.initExchange$okhttp()(RealCall.kt:255)
	at okhttp3.internal.connection.ConnectInterceptor.intercept()(ConnectInterceptor.kt:32)
	at okhttp3.internal.http.RealInterceptorChain.proceed()(RealInterceptorChain.kt:109)
	at okhttp3.internal.cache.CacheInterceptor.intercept()(CacheInterceptor.kt:95)
	at okhttp3.internal.http.RealInterceptorChain.proceed()(RealInterceptorChain.kt:109)
	at okhttp3.internal.http.BridgeInterceptor.intercept()(BridgeInterceptor.kt:83)
	at okhttp3.internal.http.RealInterceptorChain.proceed()(RealInterceptorChain.kt:109)
	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept()(RetryAndFollowUpInterceptor.kt:76)
	at okhttp3.internal.http.RealInterceptorChain.proceed()(RealInterceptorChain.kt:109)
	at okhttp3.logging.HttpLoggingInterceptor.intercept()(HttpLoggingInterceptor.kt:221)
	at okhttp3.internal.http.RealInterceptorChain.proceed()(RealInterceptorChain.kt:109)
	at com.mycompany.services.network.MyCompanyInterceptor.intercept()(MyCompanyInterceptor.kt:68)
	at okhttp3.internal.http.RealInterceptorChain.proceed()(RealInterceptorChain.kt:109)
	at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp()(RealCall.kt:201)
	at okhttp3.internal.connection.RealCall$AsyncCall.run()(RealCall.kt:517)
	at java.util.concurrent.ThreadPoolExecutor.runWorker()(ThreadPoolExecutor.java:1167)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run()(ThreadPoolExecutor.java:641)
	at java.lang.Thread.run()(Thread.java:923)
	
Screenshot 2024-08-28 at 14 47 38

If anyone have workarounds or idea of how to fix this I would appreciate it.

Thanks
Joao

@yschimke
Copy link
Collaborator

@jricardooliveira Even with this failure, it shouldn't be leading to crashes. Are you missing some error handling around these requests? Or is this outside your control?

@JozeRi
Copy link

JozeRi commented Sep 23, 2024

I'm having the 'Unable to resolve host "api.mycompany.com": No address associated with hostname' error too for a while now too.
did anyone here managed to solve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug in existing code
Projects
None yet
Development

No branches or pull requests

5 participants