jetty.project
jetty.project copied to clipboard
websocket container stop ordering
Jetty version 10.0.x
Description
In tests which do not explicitly close the all open WebSocket sessions, we frequently get the stack trace error message from onError.
2020-05-28 16:44:19.365:WARN :oejwjtc.DecoderListTest$DecoderListEndpoint:qtp396883763-17: Unhandled Error: org.eclipse.jetty.websocket.javax.tests.coders.DecoderListTest$DecoderListEndpoint@4947d28
java.nio.channels.ClosedChannelException
at org.eclipse.jetty.websocket.core.internal.WebSocketSessionState.onEof(WebSocketSessionState.java:172)
at org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession.onEof(WebSocketCoreSession.java:323)
at org.eclipse.jetty.websocket.core.internal.WebSocketConnection.onClose(WebSocketConnection.java:169)
at org.eclipse.jetty.io.SelectorManager.connectionClosed(SelectorManager.java:334)
at org.eclipse.jetty.io.ManagedSelector$DestroyEndPoint.run(ManagedSelector.java:1060)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:823)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:945)
at java.base/java.lang.Thread.run(Thread.java:834)
I think this is because the WebSocket containers are not shutting down in the correct order when doStop is called. The order we want is:
- Stop accepting new websocket connections.
- Stop the
SessionTrackerwhich will close any existing connections. - Shut down everything else.
We should review the stop order for the client and server containers on both the Javax and Jetty API implementations. The server containers might need to implement the Graceful interface to do this properly.
PR #4931 ensures that we try closing all open sessions before closing the Connectors.
We should also ensure we do not accept any new websocket connections once we start the Graceful shutdown.
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.
This issue has been closed due to it having no activity.
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.