TooTallNate / Java-WebSocket

A barebones WebSocket client and server implementation written in 100% Java.
http://tootallnate.github.io/Java-WebSocket
MIT License
10.54k stars 2.58k forks source link

reconnect() NullPointerException #745

Closed 0xZhangKe closed 6 years ago

0xZhangKe commented 6 years ago

java.lang.NullPointerException: Attempt to invoke virtual method 'long java.lang.Thread.getId()' on a null object reference at org.java_websocket.client.WebSocketClient.connect(WebSocketClient.java:269) at org.java_websocket.client.WebSocketClient.reconnect(WebSocketClient.java:222) at com.xx.websocket.WebSocketThread$WebSocketHandler.connect(WebSocketThread.java:172) at com.xx.websocket.WebSocketThread$WebSocketHandler.handleMessage(WebSocketThread.java:93) at android.os.Handler.dispatchMessage(Handler.java:110) at android.os.Looper.loop(Looper.java:232) at com.xx.websocket.WebSocketThread.run(WebSocketThread.java:60)

0xZhangKe commented 6 years ago

java.lang.NullPointerException: Attempt to invoke virtual method 'void java.lang.Thread.start()' on a null object reference at org.java_websocket.client.WebSocketClient.connect(WebSocketClient.java:270) at org.java_websocket.client.WebSocketClient.reconnect(WebSocketClient.java:222) at com.xx.websocket.WebSocketThread$WebSocketHandler.connect(WebSocketThread.java:172) at com.xx.websocket.WebSocketThread$WebSocketHandler.handleMessage(WebSocketThread.java:93) at android.os.Handler.dispatchMessage(Handler.java:110) at android.os.Looper.loop(Looper.java:232) at com.xx.websocket.WebSocketThread.run(WebSocketThread.java:60)

PhilipRoman commented 6 years ago

Thanks for catching this error! It would be nice if you could add additional information to match the issue template, especially the steps to reproduce and android/java version to make it easier to solve this issue.

0xZhangKe commented 6 years ago

Model:Meizu MX6 and OPPO A83T; System version:Android 7.1.1 Java-WebSocke versiont:1.3.8

I don't know the steps,It`s from Umeng analytics. Maybe it's because reconnect() calls many times.

marci4 commented 6 years ago

Without steps to repeat and a full template, we cannot reproduce this issue...

PhilipRoman commented 6 years ago

By the way, are you sure that only one thread accesses the WebSocketClient object and calls connect/reconnect? It could be a race condition where the socket is reset while being connected.

0xZhangKe commented 6 years ago

@PhilipRoman Yes, only one thread .

marci4 commented 6 years ago

Any update?

0xZhangKe commented 6 years ago

Sorry,I have never recovered this bug.

marci4 commented 6 years ago

No steps to repeat! No template! And cannot reproduce by reporter....

Closing issue! Best regards, marci4