Skip to content

Fail WebSocket writes after close with HttpClosedException - #6449

Merged
vietj merged 1 commit into
eclipse-vertx:masterfrom
ninadsutrave:websocket-write-closed-exception
Oct 20, 2026
Merged

vietj merged 1 commit into
eclipse-vertx:masterfrom
ninadsutrave:websocket-write-closed-exception

Conversation

@ninadsutrave

Copy link
Copy Markdown
Contributor

Fixes #5221

Writing to a closed WebSocket fails with a plain NoStackTraceThrowable ("WebSocket is closed"), so callers like Quarkus can only detect it by matching the message. This fails it with HttpClosedException instead, keeping the same message, so it can be checked with instanceof. I went with the existing exception rather than adding a new WebSocketClosedException, but happy to switch if you'd prefer a dedicated type.

Added testWriteAfterCloseFailsWithHttpClosedException to WebSocketTest.

Writing to a closed WebSocket failed with a plain NoStackTraceThrowable,
so callers could only detect it by matching the message. Use
HttpClosedException instead, keeping the same message.

Fixes eclipse-vertx#5221

Signed-off-by: Ninad Sutrave <ninadsutrave@gmail.com>
@vietj

vietj commented Oct 20, 2026

Copy link
Copy Markdown
Member

can you make a PR for the 5.2 branch @ninadsutrave ?

@ninadsutrave

Copy link
Copy Markdown
Contributor Author

Sure, opened #6450 for 5.2.

@vietj
vietj merged commit 096ea79 into eclipse-vertx:master Oct 20, 2026
8 checks passed
@vietj vietj added the bug label Oct 20, 2026
@ninadsutrave
ninadsutrave deleted the websocket-write-closed-exception branch October 21, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebSocket: introduce a reliable way to detect "WebSocket is closed" error

2 participants