java.com.chronon.apm.libs.org.springframework.messaging.MessageDeliveryException: nested exception is java.lang.IllegalStateException: WebSocketClientSockJsSession[id='1f1aafad087b4cc78047f42b47b2ea3f, url=http://127.0.0.1:8082/wsgame] is not open, current state=CLOSED

Spring JIRA | Prashant Deva | 3 months ago
  1. 0

    To reproduce: Keep the websocket client running and shutdown the server. Here is the setup and stop code - {code:java} class MyWS { void setup() throws ExecutionException, InterruptedException { WebSocketContainer webSocketContainer = new MyContainerProvider().create(); List<Transport> transports = new ArrayList<Transport>(1); transports.add(new WebSocketTransport(new StandardWebSocketClient(webSocketContainer))); SockJsClient sockJsClient = new SockJsClient(transports); sockJsClient.setMessageCodec(new StringMessageCodec()); stompClient = new WebSocketStompClient(sockJsClient); stompClient.setMessageConverter(new StringMessageConverter()); stompClient.start(); stompClient.connect(WS_URL, new MyStompSessionHandler()); } void stop() { StompSession stompSession = this.stompSession; if(stompSession!=null) { try { if(stompSession.isConnected()) { stompSession.disconnect(); Log.trace("Disconnecting from websocket"); } } catch (Exception e) { Log.debug("error disconnecting", e); } this.stompSession = null; } } private class MyStompSessionHandler extends StompSessionHandlerAdapter { @Override public void afterConnected(StompSession session, StompHeaders connectedHeaders) { MyWS.this.stompSession = session; } @Override public void handleFrame(StompHeaders headers, Object payload) { super.handleFrame(headers, payload); } @Override public void handleException(StompSession session, StompCommand command, StompHeaders headers, byte[] payload, Throwable exception) { Log.debug("Exception in realtime socket", exception); } @Override public void handleTransportError(StompSession session, Throwable exception) { MyWS.this.stop(); } } } {code} Here is the exception: {code:java} 2016-09-15 09:48:25,909 [Grizzly(1)] DEBUG - error disconnecting java.com.chronon.apm.libs.org.springframework.messaging.MessageDeliveryException: nested exception is java.lang.IllegalStateException: WebSocketClientSockJsSession[id='1f1aafad087b4cc78047f42b47b2ea3f, url=http://127.0.0.1:8082/wsgame] is not open, current state=CLOSED at java.com.chronon.apm.libs.org.springframework.messaging.simp.stomp.DefaultStompSession.execute(DefaultStompSession.java:277) at java.com.chronon.apm.libs.org.springframework.messaging.simp.stomp.DefaultStompSession.disconnect(DefaultStompSession.java:326) at java.com.chronon.apm.realtime.SpringWS.stop(SpringWS.java:88) at java.com.chronon.apm.realtime.SpringWS$MyStompSessionHandler.handleTransportError(SpringWS.java:190) at java.com.chronon.apm.libs.org.springframework.messaging.simp.stomp.DefaultStompSession.handleFailure(DefaultStompSession.java:444) at java.com.chronon.apm.libs.org.springframework.messaging.simp.stomp.DefaultStompSession.afterConnectionClosed(DefaultStompSession.java:459) at java.com.chronon.apm.libs.org.springframework.web.socket.messaging.WebSocketStompClient$WebSocketTcpConnectionHandlerAdapter.afterConnectionClosed(WebSocketStompClient.java:354) at java.com.chronon.apm.libs.org.springframework.web.socket.sockjs.client.AbstractClientSockJsSession.afterTransportClosed(AbstractClientSockJsSession.java:321) at java.com.chronon.apm.libs.org.springframework.web.socket.sockjs.client.WebSocketTransport$ClientSockJsWebSocketHandler.afterConnectionClosed(WebSocketTransport.java:172) at java.com.chronon.apm.libs.org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.onClose(StandardWebSocketHandlerAdapter.java:141) at java.com.chronon.apm.libs.org.glassfish.tyrus.core.TyrusEndpointWrapper.onClose(TyrusEndpointWrapper.java:1259) at java.com.chronon.apm.libs.org.glassfish.tyrus.core.TyrusWebSocket.onClose(TyrusWebSocket.java:130) at java.com.chronon.apm.libs.org.glassfish.tyrus.core.ProtocolHandler.close(ProtocolHandler.java:469) at java.com.chronon.apm.libs.org.glassfish.tyrus.core.TyrusWebSocket.close(TyrusWebSocket.java:264) at java.com.chronon.apm.libs.org.glassfish.tyrus.core.TyrusWebSocket.close(TyrusWebSocket.java:274) at java.com.chronon.apm.libs.org.glassfish.tyrus.core.TyrusRemoteEndpoint.close(TyrusRemoteEndpoint.java:495) at java.com.chronon.apm.libs.org.glassfish.tyrus.core.TyrusSession.close(TyrusSession.java:233) at java.com.chronon.apm.libs.org.springframework.web.socket.adapter.standard.StandardWebSocketSession.closeInternal(StandardWebSocketSession.java:217) at java.com.chronon.apm.libs.org.springframework.web.socket.adapter.AbstractWebSocketSession.close(AbstractWebSocketSession.java:139) at java.com.chronon.apm.libs.org.springframework.web.socket.handler.ExceptionWebSocketHandlerDecorator.tryCloseWithError(ExceptionWebSocketHandlerDecorator.java:94) at java.com.chronon.apm.libs.org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.handleTextMessage(StandardWebSocketHandlerAdapter.java:113) at java.com.chronon.apm.libs.org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.access$000(StandardWebSocketHandlerAdapter.java:42) at java.com.chronon.apm.libs.org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter$3.onMessage(StandardWebSocketHandlerAdapter.java:81) at java.com.chronon.apm.libs.org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter$3.onMessage(StandardWebSocketHandlerAdapter.java:78) at java.com.chronon.apm.libs.org.glassfish.tyrus.core.TyrusSession.notifyMessageHandlers(TyrusSession.java:576) at java.com.chronon.apm.libs.org.glassfish.tyrus.core.TyrusEndpointWrapper.onMessage(TyrusEndpointWrapper.java:879) at java.com.chronon.apm.libs.org.glassfish.tyrus.core.TyrusWebSocket.onMessage(TyrusWebSocket.java:216) at java.com.chronon.apm.libs.org.glassfish.tyrus.core.frame.TextFrame.respond(TextFrame.java:139) at java.com.chronon.apm.libs.org.glassfish.tyrus.core.ProtocolHandler.process(ProtocolHandler.java:807) at java.com.chronon.apm.libs.org.glassfish.tyrus.client.TyrusClientEngine$TyrusReadHandler.handle(TyrusClientEngine.java:747) at java.com.chronon.apm.libs.org.glassfish.tyrus.container.grizzly.client.GrizzlyClientFilter$ProcessTask.execute(GrizzlyClientFilter.java:476) at java.com.chronon.apm.libs.org.glassfish.tyrus.container.grizzly.client.TaskProcessor.processTask(TaskProcessor.java:114) at java.com.chronon.apm.libs.org.glassfish.tyrus.container.grizzly.client.TaskProcessor.processTask(TaskProcessor.java:91) at java.com.chronon.apm.libs.org.glassfish.tyrus.container.grizzly.client.GrizzlyClientFilter.handleRead(GrizzlyClientFilter.java:272) at java.com.chronon.apm.libs.org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119) at java.com.chronon.apm.libs.org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284) at java.com.chronon.apm.libs.org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201) at java.com.chronon.apm.libs.org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133) at java.com.chronon.apm.libs.org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112) at java.com.chronon.apm.libs.org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77) at java.com.chronon.apm.libs.org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:526) at java.com.chronon.apm.libs.org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112) at java.com.chronon.apm.libs.org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117) at java.com.chronon.apm.libs.org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56) at java.com.chronon.apm.libs.org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137) at java.com.chronon.apm.libs.org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591) at java.com.chronon.apm.libs.org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.IllegalStateException: WebSocketClientSockJsSession[id='1f1aafad087b4cc78047f42b47b2ea3f, url=http://127.0.0.1:8082/wsgame] is not open, current state=CLOSED at java.com.chronon.apm.libs.org.springframework.util.Assert.state(Assert.java:392) at java.com.chronon.apm.libs.org.springframework.web.socket.sockjs.client.AbstractClientSockJsSession.sendMessage(AbstractClientSockJsSession.java:139) at java.com.chronon.apm.libs.org.springframework.web.socket.messaging.WebSocketStompClient$WebSocketTcpConnectionHandlerAdapter.send(WebSocketStompClient.java:383) at java.com.chronon.apm.libs.org.springframework.messaging.simp.stomp.DefaultStompSession.execute(DefaultStompSession.java:274) ... 47 more {code} The exception is thrown on this line: {code} stompSession.disconnect(); {code} However, as you can see I check to see if the session is connected using the isConnected() call. The code should not throw an exception if isConnected() was checked before calling disconnect()

    Spring JIRA | 3 months ago | Prashant Deva
    java.com.chronon.apm.libs.org.springframework.messaging.MessageDeliveryException: nested exception is java.lang.IllegalStateException: WebSocketClientSockJsSession[id='1f1aafad087b4cc78047f42b47b2ea3f, url=http://127.0.0.1:8082/wsgame] is not open, current state=CLOSED
  2. 0

    Invalidating session causes exception

    GitHub | 2 years ago | vaadin-kim
    java.lang.IllegalStateException: Current VaadinSession is not open
  3. 0

    JiBX - XML Data Binding for Java / Mailing Lists

    sourceforge.net | 1 year ago
    java.lang.IllegalStateException: The current state is not START_DOCUMENT.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Unable to get cache to restart with previously stored values from disk

    Terracotta | 4 years ago | ranga
    java.lang.IllegalStateException: RestartStore is not ready for mutations. Current state INIT

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalStateException

      WebSocketClientSockJsSession[id='1f1aafad087b4cc78047f42b47b2ea3f, url=http://127.0.0.1:8082/wsgame] is not open, current state=CLOSED

      at java.com.chronon.apm.libs.org.springframework.util.Assert.state()
    2. java.com.chronon
      AbstractThreadPool$Worker.run
      1. java.com.chronon.apm.libs.org.springframework.util.Assert.state(Assert.java:392)
      2. java.com.chronon.apm.libs.org.springframework.web.socket.sockjs.client.AbstractClientSockJsSession.sendMessage(AbstractClientSockJsSession.java:139)
      3. java.com.chronon.apm.libs.org.springframework.web.socket.messaging.WebSocketStompClient$WebSocketTcpConnectionHandlerAdapter.send(WebSocketStompClient.java:383)
      4. java.com.chronon.apm.libs.org.springframework.messaging.simp.stomp.DefaultStompSession.execute(DefaultStompSession.java:274)
      5. java.com.chronon.apm.libs.org.springframework.messaging.simp.stomp.DefaultStompSession.disconnect(DefaultStompSession.java:326)
      6. java.com.chronon.apm.realtime.SpringWS.stop(SpringWS.java:88)
      7. java.com.chronon.apm.realtime.SpringWS$MyStompSessionHandler.handleTransportError(SpringWS.java:190)
      8. java.com.chronon.apm.libs.org.springframework.messaging.simp.stomp.DefaultStompSession.handleFailure(DefaultStompSession.java:444)
      9. java.com.chronon.apm.libs.org.springframework.messaging.simp.stomp.DefaultStompSession.afterConnectionClosed(DefaultStompSession.java:459)
      10. java.com.chronon.apm.libs.org.springframework.web.socket.messaging.WebSocketStompClient$WebSocketTcpConnectionHandlerAdapter.afterConnectionClosed(WebSocketStompClient.java:354)
      11. java.com.chronon.apm.libs.org.springframework.web.socket.sockjs.client.AbstractClientSockJsSession.afterTransportClosed(AbstractClientSockJsSession.java:321)
      12. java.com.chronon.apm.libs.org.springframework.web.socket.sockjs.client.WebSocketTransport$ClientSockJsWebSocketHandler.afterConnectionClosed(WebSocketTransport.java:172)
      13. java.com.chronon.apm.libs.org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.onClose(StandardWebSocketHandlerAdapter.java:141)
      14. java.com.chronon.apm.libs.org.glassfish.tyrus.core.TyrusEndpointWrapper.onClose(TyrusEndpointWrapper.java:1259)
      15. java.com.chronon.apm.libs.org.glassfish.tyrus.core.TyrusWebSocket.onClose(TyrusWebSocket.java:130)
      16. java.com.chronon.apm.libs.org.glassfish.tyrus.core.ProtocolHandler.close(ProtocolHandler.java:469)
      17. java.com.chronon.apm.libs.org.glassfish.tyrus.core.TyrusWebSocket.close(TyrusWebSocket.java:264)
      18. java.com.chronon.apm.libs.org.glassfish.tyrus.core.TyrusWebSocket.close(TyrusWebSocket.java:274)
      19. java.com.chronon.apm.libs.org.glassfish.tyrus.core.TyrusRemoteEndpoint.close(TyrusRemoteEndpoint.java:495)
      20. java.com.chronon.apm.libs.org.glassfish.tyrus.core.TyrusSession.close(TyrusSession.java:233)
      21. java.com.chronon.apm.libs.org.springframework.web.socket.adapter.standard.StandardWebSocketSession.closeInternal(StandardWebSocketSession.java:217)
      22. java.com.chronon.apm.libs.org.springframework.web.socket.adapter.AbstractWebSocketSession.close(AbstractWebSocketSession.java:139)
      23. java.com.chronon.apm.libs.org.springframework.web.socket.handler.ExceptionWebSocketHandlerDecorator.tryCloseWithError(ExceptionWebSocketHandlerDecorator.java:94)
      24. java.com.chronon.apm.libs.org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.handleTextMessage(StandardWebSocketHandlerAdapter.java:113)
      25. java.com.chronon.apm.libs.org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.access$000(StandardWebSocketHandlerAdapter.java:42)
      26. java.com.chronon.apm.libs.org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter$3.onMessage(StandardWebSocketHandlerAdapter.java:81)
      27. java.com.chronon.apm.libs.org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter$3.onMessage(StandardWebSocketHandlerAdapter.java:78)
      28. java.com.chronon.apm.libs.org.glassfish.tyrus.core.TyrusSession.notifyMessageHandlers(TyrusSession.java:576)
      29. java.com.chronon.apm.libs.org.glassfish.tyrus.core.TyrusEndpointWrapper.onMessage(TyrusEndpointWrapper.java:879)
      30. java.com.chronon.apm.libs.org.glassfish.tyrus.core.TyrusWebSocket.onMessage(TyrusWebSocket.java:216)
      31. java.com.chronon.apm.libs.org.glassfish.tyrus.core.frame.TextFrame.respond(TextFrame.java:139)
      32. java.com.chronon.apm.libs.org.glassfish.tyrus.core.ProtocolHandler.process(ProtocolHandler.java:807)
      33. java.com.chronon.apm.libs.org.glassfish.tyrus.client.TyrusClientEngine$TyrusReadHandler.handle(TyrusClientEngine.java:747)
      34. java.com.chronon.apm.libs.org.glassfish.tyrus.container.grizzly.client.GrizzlyClientFilter$ProcessTask.execute(GrizzlyClientFilter.java:476)
      35. java.com.chronon.apm.libs.org.glassfish.tyrus.container.grizzly.client.TaskProcessor.processTask(TaskProcessor.java:114)
      36. java.com.chronon.apm.libs.org.glassfish.tyrus.container.grizzly.client.TaskProcessor.processTask(TaskProcessor.java:91)
      37. java.com.chronon.apm.libs.org.glassfish.tyrus.container.grizzly.client.GrizzlyClientFilter.handleRead(GrizzlyClientFilter.java:272)
      38. java.com.chronon.apm.libs.org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      39. java.com.chronon.apm.libs.org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
      40. java.com.chronon.apm.libs.org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
      41. java.com.chronon.apm.libs.org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
      42. java.com.chronon.apm.libs.org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
      43. java.com.chronon.apm.libs.org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      44. java.com.chronon.apm.libs.org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:526)
      45. java.com.chronon.apm.libs.org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
      46. java.com.chronon.apm.libs.org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
      47. java.com.chronon.apm.libs.org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
      48. java.com.chronon.apm.libs.org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
      49. java.com.chronon.apm.libs.org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
      50. java.com.chronon.apm.libs.org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
      50 frames
    3. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:745)
      1 frame