Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-6965

Undertow fails to respond for big compressed websocket messages

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 7.1.0.DR9
    • 7.1.0.DR7
    • Undertow, Web Sockets
    • None

    Description

      When running autobahn testsuite against echoing websocket endpoint which uses BasicRemote [1], test waits for timeout as it doesn't receive expected response in time.

      I am able to reproduce it steadily (almost always) when running these two cases "12.5.7" and "12.5.8", which results in 12.5.8 to fail (when running it alone, it passes).

      Attaching the autobahn spec file and websocket application containing the endpoint.
      To reproduce don't forget, there is needed to enable the websocket compression => /subsystem=undertow/servlet-container=default/setting=websockets:write-attribute(name=per-message-deflate, value=true)

      [1]

      package test;
      
      import org.slf4j.Logger;
      import org.slf4j.LoggerFactory;
      
      import java.io.IOException;
      import java.io.OutputStream;
      import java.io.Writer;
      import javax.websocket.OnError;
      import javax.websocket.OnMessage;
      import javax.websocket.Session;
      import javax.websocket.server.ServerEndpoint;
      
      @ServerEndpoint(EchoBasicEndpoint.URL_PATTERN)
      public class EchoBasicEndpoint {
          public static final String URL_PATTERN = "/echoBasicEndpoint";
      
          private static final Logger log = LoggerFactory.getLogger(EchoBasicEndpoint.class);
      
          Writer writer;
          OutputStream stream;
      
          @OnMessage
          public void handleStringMessage(final String message, Session session, boolean last) throws IOException {
              if (writer == null) {
                  writer = session.getBasicRemote().getSendWriter();
              }
              writer.write(message);
              if (last) {
                  writer.close();
                  writer = null;
              }
          }
      
          @OnMessage
          public void handleByteMessage(final byte[] message, Session session, boolean last) throws IOException {
              if (stream == null) {
                  stream = session.getBasicRemote().getSendStream();
              }
              stream.write(message);
              stream.flush();
              if (last) {
                  stream.close();
                  stream = null;
              }
          }
      
          @OnError
          public void onError(Throwable t) {
              log.warn("WebSockets error message detected", t);
          }
      }
      

      Attachments

        1. autobahn.spec
          0.4 kB
        2. failed_12_5_8.json
          673 kB
        3. passed_12_5_8.json
          1.50 MB
        4. websocket-endpoints.war
          49 kB

        Issue Links

          Activity

            People

              sdouglas1@redhat.com Stuart Douglas
              rhatlapa@redhat.com Radim Hatlapatka (Inactive)
              Radim Hatlapatka Radim Hatlapatka (Inactive)
              Radim Hatlapatka Radim Hatlapatka (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: