jetty.project
jetty.project copied to clipboard
Serialize calls to the WebSocket Core FrameHandler
Jetty version(s) 10+
Description
Currently there is no protection against the FrameHandler being invoked concurrently by multiple threads.
In particular during an idleTimeout event, even if a FrameHandler is currently in onOpen() or onMessage() then the idleTimeout could occur and the onClosed notification would be called concurrently.
the jakarta websocket 2.1 specification states:
In all cases, the implementation must not invoke an endpoint instance with more than one thread per peer at a time [WSC-5.1-2]. The implementation may not invoke the close method on an endpoint until after the open method has completed [WSC-5.1-3].
This guarantees that a WebSocket endpoint instance is never called by more than one container thread at a time per peer [WSC-5.1-4].
Currently this is not the case as onClosed() can be called concurrently to onOpen() and onMessage(). But if we serialized the notifications to the FrameHandler in core it would solve this issue.
The FrameHandler implementations are currently not taking this into consideration, so are not protecting fields in a lock that could be modified concurrently by onMessage and onClosed.
This issue has been automatically marked as stale because it has been a full year without activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has been a full year without activity. It will be closed if no further activity occurs. Thank you for your contributions.