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

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

      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);
          }
      }
      

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

            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

              Created:
              Updated:
              Resolved: