jetty.project icon indicating copy to clipboard operation
jetty.project copied to clipboard

websocket container stop ordering

Open lachlan-roberts opened this issue 5 years ago • 5 comments

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:

  1. Stop accepting new websocket connections.
  2. Stop the SessionTracker which will close any existing connections.
  3. 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.

lachlan-roberts avatar May 28 '20 07:05 lachlan-roberts

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.

lachlan-roberts avatar Aug 03 '20 08:08 lachlan-roberts

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.

github-actions[bot] avatar Feb 25 '22 00:02 github-actions[bot]

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.

github-actions[bot] avatar Mar 01 '23 00:03 github-actions[bot]

This issue has been closed due to it having no activity.

github-actions[bot] avatar Apr 02 '23 00:04 github-actions[bot]

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.

github-actions[bot] avatar Apr 02 '24 00:04 github-actions[bot]