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

Undertow fails to respond for big compressed websocket messages

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.0.0.Beta1, 1.4.5.Final
    • None
    • None
    • 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);
          }
      }
      

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

                Created:
                Updated:
                Resolved: