StompProtocolAndroid icon indicating copy to clipboard operation
StompProtocolAndroid copied to clipboard

IllegalStateException with unreachable host

Open Erhannis opened this issue 8 years ago • 2 comments

If you (without waiting) try to connect to an unreachable host, send a message, disconnect, and connect again, the final connect attempt crashes:

W/System.err: java.lang.IllegalStateException: Already have connection to web socket W/System.err: at ua.naiksoftware.stomp.WebSocketsConnectionProvider.createWebSocketConnection(WebSocketsConnectionProvider.java:72) W/System.err: at ua.naiksoftware.stomp.WebSocketsConnectionProvider.messages(WebSocketsConnectionProvider.java:66) W/System.err: at ua.naiksoftware.stomp.client.StompClient.connect(StompClient.java:89) W/System.err: at ua.naiksoftware.stomp.client.StompClient.connect(StompClient.java:61) W/System.err: at ua.naiksoftware.stomp.client.StompClient.connect(StompClient.java:48) W/System.err: at com.aptima.csms.gpssensor.MainActivity.onStart(MainActivity.java:73) W/System.err: at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1260) W/System.err: at android.app.Activity.performStart(Activity.java:6287) W/System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2405) W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2506) W/System.err: at android.app.ActivityThread.-wrap11(ActivityThread.java) W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1363) W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102) W/System.err: at android.os.Looper.loop(Looper.java:148) W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5491) W/System.err: at java.lang.reflect.Method.invoke(Native Method) W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728) W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

(If, after disconnect(), you wait until "java.net.ConnectException: failed to connect to /192.168.1.134 (port 61613): connect failed: EHOSTUNREACH (No route to host)" happens, then the subsequent connect() doesn't crash.)

Erhannis avatar Feb 08 '17 16:02 Erhannis

This problem was probably fixed with the 1.4.1 update, back in August. It repaired several race conditions. If you're still able to reproduce this issue, please update it.

forresthopkinsa avatar Sep 29 '17 23:09 forresthopkinsa

Issue still present on version 1.4.4, same stack trace.

manfcas avatar Jan 24 '18 10:01 manfcas