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

Firebase websocket issue [Android] #8224

Closed
AlaaAttya opened this issue Jun 19, 2016 · 10 comments
Closed

Firebase websocket issue [Android] #8224

AlaaAttya opened this issue Jun 19, 2016 · 10 comments
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@AlaaAttya
Copy link

Hi guys,

I'm using Firebase's npm package (v2.4.2) for my RN app. It works fine on iOS but it throws this exception for android

06-19 10:25:16.654 2559-12442/com.aucapp E/unknown:React: Could not close WebSocket connection for id 0
java.net.SocketException: Socket is closed
at com.android.org.conscrypt.OpenSSLSocketImpl.checkOpen(OpenSSLSocketImpl.java:246)
at com.android.org.conscrypt.OpenSSLSocketImpl.access$000(OpenSSLSocketImpl.java:57)
at com.android.org.conscrypt.OpenSSLSocketImpl$SSLOutputStream.write(OpenSSLSocketImpl.java:750)
at okio.Okio$1.write(Okio.java:80)
at okio.AsyncTimeout$1.write(AsyncTimeout.java:155)
at okio.RealBufferedSink.flush(RealBufferedSink.java:221)
at com.squareup.okhttp.internal.ws.WebSocketWriter.writeControlFrame(WebSocketWriter.java:151)
at com.squareup.okhttp.internal.ws.WebSocketWriter.writeClose(WebSocketWriter.java:112)
at com.squareup.okhttp.internal.ws.RealWebSocket.close(RealWebSocket.java:135)
at com.facebook.react.modules.websocket.WebSocketModule.close(WebSocketModule.java:203)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:316)
at com.facebook.react.bridge.NativeModuleRegistry$ModuleDefinition.call(NativeModuleRegistry.java:187)
at com.facebook.react.bridge.NativeModuleRegistry.call(NativeModuleRegistry.java:62)
at com.facebook.react.bridge.CatalystInstanceImpl$NativeModulesReactCallback.call(CatalystInstanceImpl.java:432)
at com.facebook.react.bridge.queue.NativeRunnableDeprecated.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
at android.os.Looper.loop(Looper.java:135)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:187)
at java.lang.Thread.run(Thread.java:818)

@christopherdro
Copy link
Contributor

christopherdro commented Jun 19, 2016

@AlaaAttya Looks like a possible race condition. Make sure your socket connection exists before calling any methods on it. i.e this.socket && this.socket.close()

@AlaaAttya
Copy link
Author

@christopherdro i've not opening sockets in my code. It's firebase's npm package that does so.

`
var news_ref = new Firebase('project url/news');
news_ref.on('child_added', function(childSnapshot, prevChildKey) {
// ...

});
`

i think it's a bug in this library

@AlaaAttya
Copy link
Author

@christopherdro the issue with RN is that the data is getting fetched from Firebase but the listview (the component which is rendering the data) is not being updated while it's working fine on iOS. So i think it RN native layer shouldn't be crushable for this type of exception.

@rgoldiez
Copy link

Having the same problem here.

@satya164
Copy link
Contributor

Please send a PR which prints a error log instead of crashing the app.

@varungupta85
Copy link
Contributor

I am not able to read/write any data to firebase after updating to 0.30.0 in Android. I am getting a lot of errors listed below with no call stack in the logcat output:

08-02 13:04:44.747 15555-15583/com.myapp W/unknown:React: Cannot close WebSocket. Unknown WebSocket id 2
08-02 13:04:46.764 15555-15583/com.myapp W/unknown:React: Cannot close WebSocket. Unknown WebSocket id 3
08-02 13:04:48.781 15555-15583/com.myapp W/unknown:React: Cannot close WebSocket. Unknown WebSocket id 4
08-02 13:04:50.800 15555-15583/com.myapp W/unknown:React: Cannot close WebSocket. Unknown WebSocket id 5
08-02 13:04:52.814 15555-15583/com.myapp W/unknown:React: Cannot close WebSocket. Unknown WebSocket id 6

Basically it's printing one of these every 2 seconds. This was working on 0.24.0 in Android and also working in iOS with 0.30.0.

Please advise how to fix this problem. I am not sure where to make the changes. If you give me some pointers, I will be happy to try out and send a PR. Thanks!

@paramaggarwal
Copy link
Contributor

Please follow along on #8949.

@rmevans9
Copy link
Contributor

This appears to be the same issue as #8949 (as @paramaggarwal pointed out). Closing this one as a duplicate.

@rmevans9
Copy link
Contributor

@facebook-github-bot duplicate #8949

@ghost
Copy link

ghost commented Aug 16, 2016

@rmevans9 tells me this issue is a duplicate of #8949. Let's discuss there, closing this one.

@ghost ghost closed this as completed Aug 16, 2016
@ghost ghost added the Ran Commands One of our bots successfully processed a command. label Aug 16, 2016
@facebook facebook locked as resolved and limited conversation to collaborators Jul 19, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

8 participants