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

[Android] Cannot close WebSocket. repeatedly #8949

Closed
Kerumen opened this issue Jul 21, 2016 · 66 comments
Closed

[Android] Cannot close WebSocket. repeatedly #8949

Kerumen opened this issue Jul 21, 2016 · 66 comments
Labels
Platform: Android Android applications. Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@Kerumen
Copy link
Contributor

Kerumen commented Jul 21, 2016

I upgraded my project from 0.28 to 0.30 and since I have, on Android, this warning message every 2-3 seconds:

Cannot close WebSocket. Unknown WebSocket id 0

With the id increasing.

screen shot 2016-07-21 at 20 34 07

I did a fresh react-native init and it also appears. So it's not my project related.

@charpeni
Copy link
Contributor

@facebook-github-bot label Android

@facebook-github-bot facebook-github-bot added Android Ran Commands One of our bots successfully processed a command. labels Jul 21, 2016
@charpeni
Copy link
Contributor

cc @frantic

@Kerumen
Copy link
Contributor Author

Kerumen commented Jul 22, 2016

I forgot to mention that it appears both on Genymotion and on a real device.

After a bit of debugging it seems to be related to 22fbb6d.

A commit is in the pipe 46417dd but even by cherry-picking it I still have the same problem.

@vonovak
Copy link
Contributor

vonovak commented Jul 22, 2016

I also see this.

E unknown:JSPackagerWebSocketClient: Error occurred, shutting down websocket connection: Websocket exception
E unknown:JSPackagerWebSocketClient: java.net.ConnectException: Failed to connect to localhost/127.0.0.1:8081
E unknown:JSPackagerWebSocketClient:    at okhttp3.internal.io.RealConnection.connectSocket(RealConnection.java:187)
E unknown:JSPackagerWebSocketClient:    at okhttp3.internal.io.RealConnection.buildConnection(RealConnection.java:170)
E unknown:JSPackagerWebSocketClient:    at okhttp3.internal.io.RealConnection.connect(RealConnection.java:111)
E unknown:JSPackagerWebSocketClient:    at okhttp3.internal.http.StreamAllocation.findConnection(StreamAllocation.java:187)
E unknown:JSPackagerWebSocketClient:    at okhttp3.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:123)
E unknown:JSPackagerWebSocketClient:    at okhttp3.internal.http.StreamAllocation.newStream(StreamAllocation.java:93)
E unknown:JSPackagerWebSocketClient:    at okhttp3.internal.http.HttpEngine.connect(HttpEngine.java:296)
E unknown:JSPackagerWebSocketClient:    at okhttp3.internal.http.HttpEngine.sendRequest(HttpEngine.java:248)
E unknown:JSPackagerWebSocketClient:    at okhttp3.RealCall.getResponse(RealCall.java:243)
E unknown:JSPackagerWebSocketClient:    at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:201)
E unknown:JSPackagerWebSocketClient:    at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:163)
E unknown:JSPackagerWebSocketClient:    at okhttp3.RealCall.access$100(RealCall.java:30)
E unknown:JSPackagerWebSocketClient:    at okhttp3.RealCall$AsyncCall.execute(RealCall.java:127)
E unknown:JSPackagerWebSocketClient:    at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
E unknown:JSPackagerWebSocketClient:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
E unknown:JSPackagerWebSocketClient:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
E unknown:JSPackagerWebSocketClient:    at java.lang.Thread.run(Thread.java:818)
W unknown:React: Cannot close WebSocket. Unknown WebSocket id 36

@namxam
Copy link

namxam commented Jul 22, 2016

Yeah, I can confirm that this is happening for me as well.

@amovah
Copy link

amovah commented Jul 23, 2016

I have same problem, using v0.30

@dsimmons
Copy link

dsimmons commented Jul 23, 2016

Seeing the same thing on 0.30, although I can't say for sure that it didn't also occur on 0.29(it's possible that it went unnoticed).

@InnerPeace080
Copy link
Contributor

+1

@qxqxqxqx
Copy link

+1,V0.30

@efkan
Copy link

efkan commented Jul 25, 2016

+1

@yberstad
Copy link

I'm having the same problem, using v0.30.

@thebaconguy
Copy link

thebaconguy commented Jul 25, 2016

+1 / v0.30

@troytang
Copy link

+1 v0.30

@ignacioola
Copy link
Contributor

+1, v0.30

@lucasyalap
Copy link

+1 v0.30

@dotnetprofessional
Copy link

+1 I just upgraded from 0.29 which didn't have this issue.

@yonahforst
Copy link

+1 v0.30

@aimbot
Copy link

aimbot commented Jul 28, 2016

I would like to add after upgrading to v0.30 I am seeing this too. When you enable remote debugging the log also spams a lot more.

@druvisc
Copy link

druvisc commented Jul 30, 2016

I started getting these warning messages after creating and adding some native Android modules.

v0.30

@vladp
Copy link

vladp commented Jul 31, 2016

+1. Started seeing it with 0.30 as well (0.29 did not have this).
[update] Upgrading to 0.31 fixed the issue for me

@havaliza
Copy link

havaliza commented Aug 1, 2016

+1 v0.30

@39otrebla
Copy link

+1 v0.30 (w/ custom native packages registered)

@hanemason
Copy link

+1 v0.30

2 similar comments
@ruihuancao
Copy link

+1 v0.30

@WaterEye0o
Copy link

+1 v0.30

@varungupta85
Copy link
Contributor

+1 Upgraded from 0.24 to 0.30. It has caused all firebase communication to halt.

@varungupta85
Copy link
Contributor

Upgrading to 0.31.0-rc.1 seems to resolve this error.

@rimzici
Copy link

rimzici commented Jul 31, 2017

Similar Issue:
RN : 0.42
Happens so often on remote debugging.

`
E/unknown:React: Exception in native call
java.lang.RuntimeException: Cannot send a message. Unknown WebSocket id 2
at com.facebook.react.modules.websocket.WebSocketModule.send(WebSocketModule.java:221)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:345)
at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:136)
at com.facebook.react.bridge.queue.NativeRunnable.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:148)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
at java.lang.Thread.run(Thread.java:818)

                                                                       --------- beginning of system

`

@ThaJay
Copy link

ThaJay commented Aug 7, 2017

same issue as @rimzici on RN 42.3

@Hitabis
Copy link
Contributor

Hitabis commented Sep 4, 2017

@ThaJay @rimzici I'm having the same issue on production. Any updates on this?
Are you guys having this issue only in debug mode?

@GrigoryPtashko
Copy link

GrigoryPtashko commented Oct 21, 2017

I've got a similar issue. After a network reconnect I've got this one:

screenshot 2017-10-21 14 30 20

On iOS there is no such error. I've got the app logic to close the websocket after network reconnect and open a new one. On iOS this logic works perfectly. But on Android I've this error. I guess the nature of this error is the same as in the original post. What are we going to do about it?

@ghost
Copy link

ghost commented Nov 5, 2017

Same. I get this issue both in debug and production releases on Google Play. I only get this issue on Android.
skaermbillede 2017-11-05 kl 12 14 51

@guysegal
Copy link

guysegal commented Nov 5, 2017

+1
We are having A LOT of crashes in production! Is there any progress on this issue?

@ghost
Copy link

ghost commented Nov 5, 2017

@guysegal It's the most common crash in production for me as well. They need to fix this ASAP

@joseygordev
Copy link

+1

@ghost
Copy link

ghost commented Dec 7, 2017

Any updates?

React native 0.51.0

Getting this:
skaermbillede 2017-12-07 18 39 22

@GrigoryPtashko
Copy link

@guysegal @danieldelouya guys, does anyone know how can we draw the RN's team attention to this?

@jiyarong
Copy link

jiyarong commented Dec 28, 2017

+ 1
0.50.3 android

@jiyarong
Copy link

before you construct a new WebSocket instance, you need release your prev instance

this.ws.close() && this.ws = null

it works for me

@GrigoryPtashko
Copy link

@jiyarong the thing is that this error appears after network reconnect on ws.send(). This happens only on Android. iOS is good. The correct behaviour must be like on iOS: the application must go to websocket onError and there must be graceful websocket recreation. But the Android version just crashes.

@ThaJay
Copy link

ThaJay commented Dec 28, 2017

@jiyarong I have the following code in place:

    try {this.ws.close()} catch (e) {}
    this.ws = undefined

but I can still get the error.

@stale
Copy link

stale bot commented Feb 26, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Feb 26, 2018
@LaloHao
Copy link

LaloHao commented Mar 7, 2018

Any update?

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Mar 7, 2018
@ThaJay
Copy link

ThaJay commented Mar 8, 2018

@LaloHao maybe this one is relevant for you? #3346

@react-native-bot react-native-bot added Android Ran Commands One of our bots successfully processed a command. labels Mar 18, 2018
@react-native-bot react-native-bot added Platform: Android Android applications. Ran Commands One of our bots successfully processed a command. labels Mar 18, 2018
@hramos
Copy link
Contributor

hramos commented Mar 20, 2018

It looks like this issue is no longer tracking a particular failure. If you run into a WebSocket error like the above in 0.55 or newer, please open a new issue with more information.

@hramos hramos closed this as completed Mar 20, 2018
@facebook facebook locked as off-topic and limited conversation to collaborators Mar 20, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Dec 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Platform: Android Android applications. 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