com.google.firebase.database.tubesock.WebSocketException: unknown host
See original GitHub issue[REQUIRED] Step 2: Describe your environment
- Android Studio version: 2021.1.1
- Firebase Component: Database
- Component version: latest version of firebase_database in flutter.
[REQUIRED] Step 3: Describe the problem
I am using flutter and i believe that the Firebase Android SDK must be close to the latest version in the flutter plugin but i can’t find where it is declared.
Sometimes when my app start i am having this error in logs which delay the first query i am making to my database.
This was using FirebaseDatabase.instance
so there is no error for a shard URL or anything, i don’t even know this hostname :
D/PersistentConnection(29777): pc_0 - Trying to fetch auth token
D/PersistentConnection(29777): pc_0 - Trying to fetch app check token
D/PersistentConnection(29777): pc_0 - Successfully fetched token, opening connection
D/Connection(29777): conn_38 - Opening a connection
D/WebSocket(29777): ws_38 - WebSocket error.
D/WebSocket(29777): com.google.firebase.database.tubesock.WebSocketException: unknown host: s-euw1b-nss-206.europe-west1.firebasedatabase.app
D/WebSocket(29777): at com.google.firebase.database.tubesock.WebSocket.createSocket(WebSocket.java:332)
D/WebSocket(29777): at com.google.firebase.database.tubesock.WebSocket.runReader(WebSocket.java:360)
D/WebSocket(29777): at com.google.firebase.database.tubesock.WebSocket.access$000(WebSocket.java:47)
D/WebSocket(29777): at com.google.firebase.database.tubesock.WebSocket$2.run(WebSocket.java:143)
D/WebSocket(29777): at java.lang.Thread.run(Thread.java:923)
D/WebSocket(29777): Caused by: java.net.UnknownHostException: Unable to resolve host "s-euw1b-nss-206.europe-west1.firebasedatabase.app": No address associated with hostname
D/WebSocket(29777): at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:124)
D/WebSocket(29777): at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:103)
D/WebSocket(29777): at java.net.InetAddress.getAllByName(InetAddress.java:1152)
D/WebSocket(29777): at java.net.Socket.<init>(Socket.java:218)
D/WebSocket(29777): at javax.net.ssl.SSLSocket.<init>(SSLSocket.java:931)
D/WebSocket(29777): at com.android.org.conscrypt.AbstractConscryptSocket.<init>(AbstractConscryptSocket.java:97)
D/WebSocket(29777): at com.android.org.conscrypt.OpenSSLSocketImpl.<init>(OpenSSLSocketImpl.java:41)
D/WebSocket(29777): at com.android.org.conscrypt.ConscryptEngineSocket.<init>(ConscryptEngineSocket.java:77)
D/WebSocket(29777): at com.android.org.conscrypt.Java8EngineSocket.<init>(Java8EngineSocket.java:42)
D/WebSocket(29777): at com.android.org.conscrypt.Platform.createEngineSocket(Platform.java:302)
D/WebSocket(29777): at com.android.org.conscrypt.OpenSSLSocketFactoryImpl.createSocket(OpenSSLSocketFactoryImpl.java:108)
D/WebSocket(29777): at android.net.SSLCertificateSocketFactory.createSocket(SSLCertificateSocketFactory.java:598)
D/WebSocket(29777): at com.google.firebase.database.tubesock.WebSocket.createSocket(WebSocket.java:320)
D/WebSocket(29777): ... 4 more
D/WebSocket(29777): ws_38 - closing itself
D/Connection(29777): conn_38 - Realtime connection failed
D/Connection(29777): conn_38 - closing realtime connection
D/PersistentConnection(29777): pc_0 - Got on disconnect due to OTHER
D/PersistentConnection(29777): pc_0 - Scheduling connection attempt
D/ConnectionRetryHelper(29777): Scheduling retry in 688ms
D/WebSocket(29777): ws_38 - closed
Fortunately, there is an automatic retry that performs the connection again later and make queries but my UI stays black for nothing when this happens.
I have made an issue in the FlutterFire repo and they told me it was an SDK one.
They also told me to follow up on #1258 but i am not sure that this is related and the thread was locked anyway.
Steps to reproduce:
Sorry I have no idea how to reproduce it, sometimes it simply happens in my logs (no bad connection or anything).
I also believe this why my beta test users are telling me “sometimes it’s very long to load”.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:9 (4 by maintainers)
Hi @tom3652, sorry for the late response. It does look like the same issue. Due to the nature of the issue being difficult to reproduce (similar to the mentioned issue), it is hard to diagnose what the main problem is. Unless there’s a reliable reproduction, then our engineers can definitely narrow down the cause and possibly come up with a fix.
Let’s keep this issue open in case our engineers might have an idea what the issue is, and if more developers also experience this issue, they can give this a thumbs up, then our engineers can prioritize a deeper investigation depending on the severity.
Feel free to add further information if you have anything else you can share. It’ll greatly help our investigation, thanks!
Awesome, I’m glad it’s working. I’ll close this issue now.