This was a reported bug and fixed in the latest version of Jetty.
Be sure you are using the latest version of Jetty, use  9.3.6.v20151106.

Also of note, there's Session close (the websocket layer), and connection
close (the endpoint layer).
If you harsh close the connection layer, without going through a proper
Session close handshake, then the idle timeout has to kick in to close the
Connection and then Session.


Joakim Erdfelt / [email protected]

On Wed, Jan 6, 2016 at 10:55 AM, Amit Dev <[email protected]> wrote:

> Hi,
>
> I'm using websockets with embedded jetty and somehow the websocket related
> objects are not cleaned up even after closing the connection. I'm using it
> as follows:
>
> @ServerEndpoint(value="/websocket/")
> public class WebSocketEndpoint {
>  @OnOpen
>  void foo() {}
>
>  @OnClose
>  void bar() {}
> }
>
> etc. Everything is working fine, except that the endpoint objects are not
> getting gc'd. Looks like it is referred by ApplicationShutdownHooks or
> something. Following is a partial snapshot of referred objects:
>
> this     - value: WebSocketEndpoint #1
>  <- websocket     - class:
> org.eclipse.jetty.websocket.jsr356.endpoints.JsrAnnotatedEventDriver,
> value: com.oracle.ofsc.chat.endpoints.WebSocketEndpoint #1
>   <- incomingHandler     - class:
> org.eclipse.jetty.websocket.jsr356.JsrSession, value:
> org.eclipse.jetty.websocket.jsr356.endpoints.JsrAnnotatedEventDriver #1
>    <- _bean     - class:
> org.eclipse.jetty.util.component.ContainerLifeCycle$Bean, value:
> org.eclipse.jetty.websocket.jsr356.JsrSession #1
>     <- [2]     - class: java.lang.Object[], value:
> org.eclipse.jetty.util.component.ContainerLifeCycle$Bean #82
>      <- array     - class: java.util.concurrent.CopyOnWriteArrayList,
> value: java.lang.Object[] #2869
>       <- _beans     - class:
> org.eclipse.jetty.websocket.server.WebSocketServerFactory, value:
> java.util.concurrent.CopyOnWriteArrayList #70
>        <- webSocketServerFactory     - class:
> org.eclipse.jetty.websocket.jsr356.server.ServerContainer, value:
> org.eclipse.jetty.websocket.server.WebSocketServerFactory #1
>         <- [0]     - class: java.lang.Object[], value:
> org.eclipse.jetty.websocket.jsr356.server.ServerContainer #1
>          <- array     - class: java.util.concurrent.CopyOnWriteArrayList,
> value: java.lang.Object[] #2001
>           <- _lifeCycles     - class:
> org.eclipse.jetty.util.thread.ShutdownThread, value:
> java.util.concurrent.CopyOnWriteArrayList #55
>            <- [36]     - class: java.lang.Object[], value:
> org.eclipse.jetty.util.thread.ShutdownThread #1
>             <- table     - class: java.util.IdentityHashMap, value:
> java.lang.Object[] #1084
>              <- hooks (sticky class)     - class:
> java.lang.ApplicationShutdownHooks, value: java.util.IdentityHashMap #1
>
> Any help is greatly appreciated. I'm trying to debug further.
>
> Thanks,
> amit
>
> _______________________________________________
> jetty-users mailing list
> [email protected]
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>
_______________________________________________
jetty-users mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to