dropwizard-websocket-jsr356-bundle
dropwizard-websocket-jsr356-bundle copied to clipboard
Server shutdown closes websockets with wrong close code
Shutting down dropwizard closes all websockets with close code 1000 NORMAL_CLOSURE, instead of the correct one 1001 GOING_AWAY.
This impacts robust-websocket, which won't trigger a reconnection in case of a server restart because the server initiated closure is marked as normal.
WebSocketServerFactory#onStop does close all open sessions with StatusCode.SHUTDOWN, but the fact remains that dropwizard does not (double checked with wireshark).
I added a breakpoint to the close method in AbstractWebSocketConnection. After sending a TERM signal to dropwizard it triggered, but not due to WebSocketServerFactory...
Thread [dw-24] (Suspended (breakpoint at line 249 in AbstractWebSocketConnection))
WebSocketServerConnection(AbstractWebSocketConnection).close() line: 249
SelectorManager$ManagedSelector.closeNoExceptions(Closeable) line: 724
SelectorManager$ManagedSelector.access$1100(SelectorManager$ManagedSelector, Closeable) line: 407
SelectorManager$ManagedSelector$EndPointCloser.run() line: 1031
InstrumentedQueuedThreadPool(QueuedThreadPool).runJob(Runnable) line: 635
QueuedThreadPool$3.run() line: 555
Thread.run() line: 745
I had abandoned this project, but am reviving it for DW 4. Will be looking into this.
Now that DW 4.0 is out, I'll be picking this up again.