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.

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:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
argzdevcommented, Feb 14, 2022

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!

1reaction
argzdevcommented, Apr 1, 2022

Awesome, I’m glad it’s working. I’ll close this issue now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[firebase_database] com.google.firebase.database.tubesock ...
WebSocketException : unknown host #7990 ... D/WebSocket(29777): at com.google.firebase.database.tubesock.WebSocket.
Read more >
Errors when accessing Firebase Realtime Database in Unity
I'm using Firebase Realtime Database to store stats in my game. I referred to their docs and ... TubeSock.WebSocketException: unknown host:.
Read more >
[Unity] Realtime database issues on iOS & Android
On iOS I get the following: InvalidOperationException: The firebase realtime database has not been properly initialized. at Firebase.Database.Core.
Read more >
Unity Firebase WebSocket Error - Unity Forum
WebSocket: ws_0 - WebSocketException during handshake. Firebase.Database.Internal.TubeSock.WebSocketException: unknown host also described in those topics:
Read more >
Select locations for your project | Firebase Documentation
Google Analytics — If you enable Google Analytics in your Firebase project ... Note that the locations of your Realtime Database instances do...
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