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

Browser close causes IOException instead of ChannelClosedException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • None
    • Core

      When I have an open websocket connection and I close the browser, put my client computer to standby or when the internet connection breaks (bad reception, etc.), Undertow will throw the exception below in my @OnError handler. Since closing a browser window and all the other cases are not really exceptional cases, a more specific exception (maybe ChannelClosedException, although it was not properly closed) or simply calling @OnClose would be appropriate.

      @OnError suggests that something really went wrong, my application logs this and the log files are full of canceled websocket connections where the use simply closed the tab. Apart from the (localized) exception message, it is not possible to distinguish the IOException from other, really important IOExceptions, so that it is difficult to suppress it.

      (The exception message is German for "An existing connection was forcibly closed by the remote host".)
      Error in WebSocket handler: java.io.IOException: Eine vorhandene Verbindung wurde vom Remotehost geschlossen
      at sun.nio.ch.SocketDispatcher.read0(Native Method) [rt.jar:1.8.0_31]
      at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43) [rt.jar:1.8.0_31]
      at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) [rt.jar:1.8.0_31]
      at sun.nio.ch.IOUtil.read(IOUtil.java:192) [rt.jar:1.8.0_31]
      at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:379) [rt.jar:1.8.0_31]
      at org.xnio.nio.NioSocketConduit.read(NioSocketConduit.java:282)
      at io.undertow.conduits.IdleTimeoutConduit.read(IdleTimeoutConduit.java:171) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
      at org.xnio.conduits.ConduitStreamSourceChannel.read(ConduitStreamSourceChannel.java:127)
      at io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:273) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
      at io.undertow.websockets.core.AbstractReceiveListener.handleEvent(AbstractReceiveListener.java:38) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
      at io.undertow.websockets.core.AbstractReceiveListener.handleEvent(AbstractReceiveListener.java:33) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
      at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
      at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:755) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
      at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:743) [undertow-core-1.1.0.Final.jar:1.1.0.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:88)
      at org.xnio.nio.WorkerThread.run(WorkerThread.java:539)

            sdouglas1@redhat.com Stuart Douglas
            philipp91 Philipp Keck (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: