diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketChannel.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketChannel.java index 7db48c1d95f..6e615b329dd 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketChannel.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketChannel.java @@ -524,19 +524,22 @@ public class WebSocketChannel implements IncomingFrames, FrameHandler.CoreSessio } catch (Throwable ex) { - try + if (frame.getOpCode() == OpCode.CLOSE) { + CloseStatus closeStatus = CloseStatus.getCloseStatus(frame); + if (closeStatus instanceof AbnormalCloseStatus) + closeConnection(null, closeStatus, Callback.from( + ()->callback.failed(ex), + x2-> + { + ex.addSuppressed(x2); + callback.failed(ex); + })); + else + callback.failed(ex); + } + else callback.failed(ex); - } - finally - { - if (frame.getOpCode() == OpCode.CLOSE) - { - CloseStatus closeStatus = CloseStatus.getCloseStatus(frame); - if (closeStatus instanceof AbnormalCloseStatus) - closeConnection(null, closeStatus, NOOP); - } - } } }