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

Undertow websocket server throws "UT002010: Received continuation data frame outside fragmented message"

    XMLWordPrintable

Details

    Description

      I'm getting UT002010: Received continuation data frame outside fragmented message exception thrown:
      io.undertow.websockets.core.WebSocketFrameCorruptedException: UT002010: Received continuation data frame outside fragmented message
      at io.undertow.websockets.core.protocol.version07.WebSocket07Channel$WebSocketFrameHeader.validateDataFrame(WebSocket07Channel.java:413) ~[undertow-core-1.4.18.Final.jar:1.4.18.Final]
      at io.undertow.websockets.core.protocol.version07.WebSocket07Channel$WebSocketFrameHeader.handle(WebSocket07Channel.java:262) ~[undertow-core-1.4.18.Final.jar:1.4.18.Final]
      at io.undertow.websockets.core.WebSocketChannel.parseFrame(WebSocketChannel.java:164) [undertow-core-1.4.18.Final.jar:1.4.18.Final]
      at io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:427) [undertow-core-1.4.18.Final.jar:1.4.18.Final]
      at io.undertow.websockets.core.AbstractReceiveListener.handleEvent(AbstractReceiveListener.java:38) [undertow-core-1.4.18.Final.jar:1.4.18.Final]
      at io.undertow.websockets.core.AbstractReceiveListener.handleEvent(AbstractReceiveListener.java:33) [undertow-core-1.4.18.Final.jar:1.4.18.Final]
      at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) [xnio-api-3.3.8.Final.jar:3.3.8.Final]
      at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:932) [undertow-core-1.4.18.Final.jar:1.4.18.Final]
      at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:913) [undertow-core-1.4.18.Final.jar:1.4.18.Final]
      at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) [xnio-api-3.3.8.Final.jar:3.3.8.Final]
      at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener$1.run(AbstractFramedChannel.java:939) [undertow-core-1.4.18.Final.jar:1.4.18.Final]
      at io.undertow.server.protocol.framed.AbstractFramedChannel$3.run(AbstractFramedChannel.java:231) [undertow-core-1.4.18.Final.jar:1.4.18.Final]
      at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:582) [xnio-nio-3.3.8.Final.jar:3.3.8.Final]
      at org.xnio.nio.WorkerThread.run(WorkerThread.java:466) [xnio-nio-3.3.8.Final.jar:3.3.8.Final]

      This exception raised when my WebSocket client sends a large amount of data and at the same time, the server sends WebSocket pings as a health check mechanism.
      The server gets fragmented frame but for some reason the fragmentedFramesCount counter is 0 and that exception raised.

      I started to debug the issue and reached the following code:
      https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/websockets/core/protocol/version07/WebSocket07Channel.java#L390

      It seems that the server doesn't set fragmentedFramesCount to 0 only if the opcode is OPCODE_PING but I think that it should also do that when the opcode is OPCODE_PONG.

      You can find a reproducer here: https://github.com/eldadru/undertow-UT002010-reproducer
      I only managed to reproduce the issue using Golang gorilla websocket library therefore the client is written in go.

      Thanks,
      Eldad.

      Attachments

        Activity

          People

            sdouglas1@redhat.com Stuart Douglas
            eldadru_jira Eldad Rudich (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: