dropwizard-websocket-jsr356-bundle icon indicating copy to clipboard operation
dropwizard-websocket-jsr356-bundle copied to clipboard

Server shutdown closes websockets with wrong close code

Open sergio91pt opened this issue 8 years ago • 3 comments

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.

sergio91pt avatar Dec 30 '16 00:12 sergio91pt

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  

sergio91pt avatar Dec 30 '16 01:12 sergio91pt

I had abandoned this project, but am reviving it for DW 4. Will be looking into this.

TomCools avatar May 19 '22 19:05 TomCools

Now that DW 4.0 is out, I'll be picking this up again.

TomCools avatar Apr 27 '23 11:04 TomCools