Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-329

Using iPhone simulator (iOs8) for reloading on a websocket produces a ClosedChannelException

    XMLWordPrintable

Details

    • Medium

    Description

      I wrote a chat application using websockets:

      @Stateless
      @ServerEndpoint(value = "/chat/{room}", decoders = { MessageDecoder.class }, encoders = { MessageEncoder.class }, configurator = ServletAwareConfig.class)
      public class ChatEndpoint {
      
      	private static final Logger log = Logger.getLogger(ChatEndpoint.class
      			.getName());
      
      	@OnOpen
      	public void open(Session session, EndpointConfig config,
      			@PathParam("room") String room) {
      		log.info("Client joined: " + session);		
      	}
      
      	@OnClose
      	public void close(Session session, CloseReason closeReason) {
      		log.info("Client left: " + session);
      	}
      
      	@OnMessage
      	public void onMessage(AbstractMessage abstractMessage, Session session) {
      
      	}
      
      	@OnError
      	public void error(Session session, Throwable t) {
      		log.log(Level.WARNING, "General error. " + session, t);
      	}
      }
      

      When using the iPhone simulator for connecting to the application and then clicking reload undertow reports an error for this disconnect.

      I would expect that the close function is called.

      16:02:53,853 WARNING [de.apaxo.chat.ChatEndpoint] (default task-17) General error. io.undertow.websockets.jsr.UndertowSession@2c302c48: java.nio.channels.ClosedChannelException
      	at io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:260) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
      	at io.undertow.websockets.core.AbstractReceiveListener.handleEvent(AbstractReceiveListener.java:20) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
      	at io.undertow.websockets.core.AbstractReceiveListener.handleEvent(AbstractReceiveListener.java:15) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
      	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
      	at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:632) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
      	at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:618) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
      	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
      	at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
      	at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:87)
      	at org.xnio.nio.WorkerThread.run(WorkerThread.java:539)
      

      Attachments

        Issue Links

          Activity

            People

              sdouglas1@redhat.com Stuart Douglas
              manuelb_jira Manuel Blechschmidt (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: