Firestore exception - Unable to resolve host firestore.googleapis.com,
See original GitHub issueHi all. I’m using latest firebase_cloud release to flutter (3.1.6) but I think it’s the sdk issue. I have the following on my code:
result = await FirebaseFirestore.instance .collection( 'fields') .get(GetOptions(source: Source.server));
Which works fine. But! Sometime after the screen of my phone (Pixel 3a android 12, samsung galaxy a12 android 11) goes off, after a while i see the following exception:
W/ManagedChannelImpl( 7914): [{0}] Failed to resolve name. status={1} W/Firestore( 7914): (24.0.0) [WatchStream]: (f8463fe) Stream closed with status: Status{code=UNAVAILABLE, description=Unable to resolve host firestore.googleapis.com, cause=java.lang.RuntimeException: java.net.UnknownHostException: Unable to resolve host “firestore.googleapis.com”: No address associated with hostname W/Firestore( 7914): at io.grpc.internal.DnsNameResolver.resolveAddresses(DnsNameResolver.java:223) W/Firestore( 7914): at io.grpc.internal.DnsNameResolver.doResolve(DnsNameResolver.java:282) W/Firestore( 7914): at io.grpc.internal.DnsNameResolver$Resolve.run(DnsNameResolver.java:318) W/Firestore( 7914): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) W/Firestore( 7914): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) W/Firestore( 7914): at java.lang.Thread.run(Thread.java:923) W/Firestore( 7914): Caused by: java.net.UnknownHostException: Unable to resolve host “firestore.googleapis.com”: No address associated with hostname W/Firestore( 7914): at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:156) W/Firestore( 7914): at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:103) W/Firestore( 7914): at java.net.InetAddress.getAllByName(InetAddress.java:1152) W/Firestore( 7914): at io.grpc.internal.DnsNameResolver$JdkAddressResolver.resolveAddress(DnsNameResolver.java:631) W/Firestore( 7914): at io.grpc.internal.DnsNameResolver.resolveAddresses(DnsNameResolver.java:219) W/Firestore( 7914): … 5 more W/Firestore( 7914): Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname) W/Firestore( 7914): at libcore.io.Linux.android_getaddrinfo(Native Method) W/Firestore( 7914): at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:73) W/Firestore( 7914): at libcore.io.BlockGuardOs.android_getaddrinfo(BlockGuardOs.java:202) W/Firestore( 7914): at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:73) W/Firestore( 7914): at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:135) W/Firestore( 7914): … 9 more W/Firestore( 7914): }.
When I resume my app, and the above code is called again i get exception:
ERROR: [cloud_firestore/unavailable] The service is currently unavailable. This is a most likely a transient condition and may be corrected by retrying with a backoff. I/flutter ( 7914): #0 MethodChannelQuery.get (package:cloud_firestore_platform_interface/src/method_channel/method_channel_query.dart:110:7) I/flutter ( 7914): <asynchronous suspension> I/flutter ( 7914): #1 _JsonQuery.get (package:cloud_firestore/src/query.dart:390:9) I/flutter ( 7914): <asynchronous suspension>
Any Idea what causes it? I tried to call retries on the above get() but the same error occurred. The workaround is calling terminate on the firestore object and then recall the above get() and it seem to solve it.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:12 (5 by maintainers)
Top Related StackOverflow Question
So this is a grpc-java issue which has been reported here: https://github.com/grpc/grpc-java/issues/8850
In the issue there is a link to a potential fix, we will be working with grpc team to get this released ASAP.
Will update this issue when it is fixed.
It seems that version 24.0.2 of firebase-firestore includes the GRPC fix and solves the issue.