FUSE Message Broker
  1. FUSE Message Broker
  2. MB-1197

Race condition with StompServlet and transport listener for websockets

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Done
    • Affects Version/s: 5.6.0-fuse-00-00
    • Fix Version/s: 5.6.0-fuse-00-00
    • Component/s: broker
    • Labels:
      None
    • Similar Issues:
      Show 9 results 

      Description

      In the StompServlet, when a websocket request comes in, we are starting up the broker's websocket connection when we call listener.onAccept(socket).
      Under the covers, it begins a task in a new thread to create the connection, instantiate the transport listener, and set the listener on the transport. However, this is done asynchronously, and when the StompServlet calls listener.onAccept(socket), it immediately returns to the underlying jetty websockets implementation, returning the StompSocket (which as the websocket onTextMessage listener). It seems it's possible the jetty code could call back the onTextMessage listener's onMessage(...) method and expect the StompSocket to process the Stomp message before the steps taken to complete creating the connection from the async listener.onAccept(..) call. This would cause the exception in DEV-4312. I have reproduced, but only in a debugger not with live-running examples. I suspect if the conditions are just right (lock contention, for example) the issue in DEV-4312 could happen in a live system.

        Gliffy Diagrams

          Activity

          Hide
          christian posta added a comment -

          Added patch

          Show
          christian posta added a comment - Added patch
          Hide
          Dejan Bosanac added a comment -

          Fixed at apache trunk. It'll be available in 5.6 release. Thanks for the patch

          Show
          Dejan Bosanac added a comment - Fixed at apache trunk. It'll be available in 5.6 release. Thanks for the patch

            People

            • Assignee:
              Dejan Bosanac
              Reporter:
              christian posta
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: