Skip to content
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

Tracking of WebSocket Sessions in WebSocket containers #3379

Closed
joakime opened this issue Feb 21, 2019 · 7 comments
Closed

Tracking of WebSocket Sessions in WebSocket containers #3379

joakime opened this issue Feb 21, 2019 · 7 comments
Assignees

Comments

@joakime
Copy link
Contributor

joakime commented Feb 21, 2019

In Jetty 9.x all open sessions are tracked for when the container (client or server) is stopped via the Jetty lifecycle.
This is used by both Jetty WebSockets and Javax WebSockets to gracefully close all open connections when the container stops (this is tracked in issue #3375)

This tracking is also used by Jetty WebSocket API and Javax WebSocket API to return the list of open sessions via the session.getOpenSessions() API.

@joakime joakime changed the title Jetty 10 WebSocket is missing graceful shutdown of WebSocket Sessions/Connections Jetty 10 WebSocket is missing tracking of WebSocket Sessions Feb 21, 2019
@joakime
Copy link
Contributor Author

joakime commented Feb 21, 2019

In a conversation with @sbordet the tracking shouldn't be accomplished via raw ContainerLifeCycle.addBean() as this can be problematic with large collections.
The past issue about this in HTTP2 resulted in a new collection object being tracked as a LifeCycle child on the containers lifecycle with the individual HTTP2 sessions being just entries on this special purpose collection object.
The implementation in Jetty 9 should move to this collection object, and the implementation in Jetty 10 should provide the same functionality.

@joakime joakime changed the title Jetty 10 WebSocket is missing tracking of WebSocket Sessions Tracking of WebSocket Sessions in WebSocket containers Feb 21, 2019
@joakime
Copy link
Contributor Author

joakime commented Feb 21, 2019

In Jetty 9.4.x there is a WebSocketSessionListener that is used to handle the add/remove of sessions to this collection.
Issue #3378 was created to add this listener back to the Jetty 10 implementation.

@joakime joakime self-assigned this Feb 21, 2019
joakime added a commit that referenced this issue Feb 21, 2019
…cket Container

Signed-off-by: Joakim Erdfelt <joakim@erdfelt.com>
joakime added a commit that referenced this issue Feb 21, 2019
… Container APIs

Signed-off-by: Joakim Erdfelt <joakim@erdfelt.com>
@sbordet
Copy link
Contributor

sbordet commented Feb 21, 2019

HTTP2 equivalent was reported in #2828.

joakime added a commit that referenced this issue Feb 21, 2019
… Container APIs

+ Jetty WebSocket API now tracks Sessions and will close them on
  lifecycle stop
+ Javax WebSocket API now tracks Sessions and will close them on
  lifecycle stop
+ Adding Jetty WebSocket tests for proper close / session tracking

Signed-off-by: Joakim Erdfelt <joakim@erdfelt.com>
@joakime
Copy link
Contributor Author

joakime commented Feb 21, 2019

Opened PR #3383

@gregw
Copy link
Contributor

gregw commented Feb 22, 2019

Can you explain why this is needed? The managed selector would already close we connections on stop?

@joakime
Copy link
Contributor Author

joakime commented Feb 22, 2019

First is to support session.getOpenSessions()

Then there's the tear down at the Session level, along with the application notification requirements.
Not sure closing via the managed selector is sufficient here.

Then there's the ability to hook into the Session activity via listeners (something people have asked for).
Then there's also the graceful shutdown that others have asked for.

These features exist on Jetty 9.4.x currently btw.
This issue is for Jetty 10.0.x

joakime added a commit that referenced this issue Feb 27, 2019
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
joakime added a commit that referenced this issue Feb 27, 2019
… Container APIs

+ Jetty WebSocket API now tracks Sessions and will close them on
  lifecycle stop
+ Javax WebSocket API now tracks Sessions and will close them on
  lifecycle stop
+ Adding Jetty WebSocket tests for proper close / session tracking
+ Disabling tests that need triage

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
joakime added a commit that referenced this issue Feb 27, 2019
…ession-tracking

Issue #3379 - Add tracking of WebSocket Sessions to various WebSocket Container APIs
@joakime
Copy link
Contributor Author

joakime commented Mar 1, 2019

Completed, and merged.

@joakime joakime closed this as completed Mar 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants