Jetty 9 org.eclipse.jetty.websocket.common.WebSocketSession.disconnect() bug

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Jetty 9 org.eclipse.jetty.websocket.common.WebSocketSession.disconnect() bug

dhirajpraj
This post has NOT been accepted by the mailing list yet.
Hi,
I am using jetty 9 websocket api for my application. One thing that i noticed is that when the websocket session is disconnected by closing the client browser window or by invoking org.eclipse.jetty.websocket.common.WebSocketSession.disconnect() does not remove the entry of that session from the set of open sessions maintained by org.eclipse.jetty.websocket.server.WebSocketServerFactory. (This cleanup is however done on invoking org.eclipse.jetty.websocket.common.WebSocketSession.close() ).
Hence, my application goes out of memory once there are too many opensessions in the set maintained by WebSocketServerFactory because many users prefer to abruptly close the browser window. As a work around to fix it in my application, I explicitly call WebSocketSession.close() in my method which handles @OnWebSocketClose.
I think this is a bug as  opensessions cleanup should be done on WebSocketSession.disconnect() as well, because the session is anyways not open ( isOpen() returns false ) when disconnect() is invoked.

Regards,
Dhiraj