-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CompressionPools are not shared between multiple contexts for 9.4 WebSocket #7078
Comments
Signed-off-by: Lachlan Roberts <[email protected]>
Signed-off-by: Lachlan Roberts <[email protected]>
…essionPools Issue #7078 - share inflater/deflater pools for websocket in jetty 9.4
Merged PR #7079. |
This change now appears to prevent Raw error:
|
@tresf is this embedded Jetty or standalone? If embedded, how are you initializing websocket? It should look like this ... ServletContextHandler servletContextHandler = new ServletContextHandler(ServletContextHandler.SESSIONS);
// various things initializing the ServletContextHandler
WebSocketUpgradeFilter.configure(servletContextHandler); Note that you can use This lambda configures the |
@tresf I see from your stacktrace the error is from It doesn't make much sense to be configuring the mappings before starting as the mappings are cleared on restart, so this change was intentional as without it other use cases are broken. I see that this change does break your usage of The preferred way to do this is with the // Handle WebSocket connections
WebSocketUpgradeFilter filter = WebSocketUpgradeFilter.configure(context);
NativeWebSocketServletContainerInitializer.configure(context, (context, container) ->
{
container.addMapping(new ServletPathSpec("/"), (req, resp) -> new PrintSocketClient(server));
container.getPolicy().setMaxTextMessageSize(MAX_MESSAGE_SIZE);
}); I think you would have same logic as before by using the deprecated |
@lachlan-roberts, @joakime much thanks, minor changes (commented) all working now. 🍻 // Handle WebSocket connections
WebSocketUpgradeFilter.configure(context); // NOTE: return object no longer required
NativeWebSocketServletContainerInitializer.configure(context, (ctx, container) -> { // NOTE: context is already declared
container.addMapping(new ServletPathSpec("/"), (req, resp) -> new PrintSocketClient(server));
container.getPolicy().setMaxTextMessageSize(MAX_MESSAGE_SIZE);
}); |
jetty/jetty.project#7078 caused a regression in the way WebSocketUpgradeFilters could be applied. This change was intentional, using API as instructed by Jetty team. :)
Target Jetty version(s)
9.4.x
Enhancement Description
There should be only one instance of
InflaterPool
andDeflaterPool
kept on the server and shared with all contexts.The text was updated successfully, but these errors were encountered: