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

resumeReceives not always working for SSL-based WebSocketChannel

    Details

    • Steps to Reproduce:
      Hide

      I have a test case that reproduces ~90% of the time, but it involves a lot of proprietary code, and I don't have time to reduce it to an MCVE. I'm happy to test any proposed fixes, however.

      FWIW, My test case involves connecting 5000+ clients via SSL WebSockets, each of which sends a short JSON message to the server every 5 seconds on average, and the server calls suspendReceives and resumeReceives before and after each message is processed, respectively.

      Show
      I have a test case that reproduces ~90% of the time, but it involves a lot of proprietary code, and I don't have time to reduce it to an MCVE. I'm happy to test any proposed fixes, however. FWIW, My test case involves connecting 5000+ clients via SSL WebSockets, each of which sends a short JSON message to the server every 5 seconds on average, and the server calls suspendReceives and resumeReceives before and after each message is processed, respectively.

      Description

      While load testing my Undertow-based application, I noticed that occasionally one of the WebSocket connections would stop receiving messages.

      On a hunch, I commented out the calls to suspendReceives and resumeReceives (which I was using to provide backpressure while a potentially long-running asynchronous message processor does its work), and the problem went away.

      Digging deeper, I examined the Undertow source code and theorized that the implementation of resumeReceives might not be correct for SSL channels, where during a handshake reads may require writes and vice-versa. So I came up with the attached hacky, heavy-handed patch (TL;DR: call wakeupReads and wakeupWrites unconditionally).

      AFAICT, that patch fixes the problem.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                swd847 Stuart Douglas
                Reporter:
                dicej Joel Dice
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: