You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Question
Hi, I'm not sure I understand how the graceful stop (PR #4931) is supposed to work - if I call WebSocketClient#stop, it ends up calling SessionTracker#doStop which according to the PR clears the sessions without notifying the server via close(StatusCode.NORMAL). Setting WebSocketClient#setStopAtShutdown(true) and shutting down the program also doesn't notify the server.
#4919 states this intended order of stop operations:
Stop accepting new websocket connections.
Stop the SessionTracker which will close any existing connections.
Shut down everything else.
Is step 2 not supposed to close connections and wait for the write, at least until the shutdown timeout? It seems to me that stopping the SessionTracker ends up ignoring existing sessions instead of closing them.
I suppose that before calling stop, I can close the sessions manually while also blocking new connections to prevent a race condition, but The Programming Guide's paragraph on stopping the WebSocket client for Jetty 10-12 doesn't mention this.
Thanks!
The text was updated successfully, but these errors were encountered:
The SesssionTracker implements the Graceful interface. This has a method CompletableFuture<Void> shutdown() which iterates over the sessions closing them with a websocket close status code of 1001 which indicates the endpoint is being shutdown.
The WebSocketClient.doStop() calls Graceful.shutdown(this).get(getStopTimeout(), TimeUnit.MILLISECONDS) which should attempt graceful shutdown of the SessionTracker.
Is the graceful shutdown of the WebSocketClient not working for you? or are you just trying to determine how it is working?
Strange, it was not working for me a few days ago - I was hitting a breakpoint on SessionTracker#doStop, was not hitting a breakpoint on the session.close call in SessionTracker#shutdown, and onWebSocketClose on the server side was not being called. I tried it again now and the shutdown works as expected.
The only thing I can think of is that the thread got interrupted somehow which would skip the session.close call. I can't remember if I tried to place the breakpoint at the beginning of the loop or not... oh well. I assume it was an error on my end then.
Jetty Version
11.0.18
Java Version
17
Question
Hi, I'm not sure I understand how the graceful stop (PR #4931) is supposed to work - if I call
WebSocketClient#stop
, it ends up callingSessionTracker#doStop
which according to the PR clears the sessions without notifying the server viaclose(StatusCode.NORMAL)
. SettingWebSocketClient#setStopAtShutdown(true)
and shutting down the program also doesn't notify the server.#4919 states this intended order of stop operations:
Is step 2 not supposed to close connections and wait for the write, at least until the shutdown timeout? It seems to me that stopping the
SessionTracker
ends up ignoring existing sessions instead of closing them.I suppose that before calling
stop
, I can close the sessions manually while also blocking new connections to prevent a race condition, but The Programming Guide's paragraph on stopping the WebSocket client for Jetty 10-12 doesn't mention this.Thanks!
The text was updated successfully, but these errors were encountered: