Skip to content

Auto-port 4.1: Release the handshake response when a WebSocket extension is rejected - #18329

Merged
normanmaurer merged 2 commits into
4.1from
auto-port-pr-18322-to-4.1
Nov 11, 2026
Merged

normanmaurer merged 2 commits into
4.1from
auto-port-pr-18322-to-4.1

Conversation

@netty-project-bot

Copy link
Copy Markdown
Contributor

Auto-port of #18322 to 4.1
Cherry-picked commit: bc6f58a


Motivation:

WebSocketClientExtensionHandler throws CodecException when the server accepts an extension that the client did not offer, but it keeps the FullHttpResponse referenced. The pipeline does not release a message when a handler throws, so the response content buffer leaks. WebSocketServerExtensionHandler already releases the request before throwing in the same situation.

Modification:

Release the response with ReferenceCountUtil before throwing the CodecException.

Result:

The handshake response is released and the leak is gone. Added a regression test that feeds a FullHttpResponse naming an unaccepted extension and asserts the response refCnt drops to 0.

Fixes #18318.

…#18322)

Motivation:

`WebSocketClientExtensionHandler` throws `CodecException` when the
server accepts an extension that the client did not offer, but it keeps
the `FullHttpResponse` referenced. The pipeline does not release a
message when a handler throws, so the response content buffer leaks.
`WebSocketServerExtensionHandler` already releases the request before
throwing in the same situation.

Modification:

Release the response with `ReferenceCountUtil` before throwing the
`CodecException`.

Result:

The handshake response is released and the leak is gone. Added a
regression test that feeds a `FullHttpResponse` naming an unaccepted
extension and asserts the response `refCnt` drops to 0.

Fixes #18318.

(cherry picked from commit bc6f58a)
@testlens-app

testlens-app Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: eff423e
▶️ Tests: 112239 executed
⚪️ Checks: 19/19 completed


Learn more about TestLens at testlens.app/docs.

@normanmaurer
normanmaurer merged commit 0c3af66 into 4.1 Nov 11, 2026
20 checks passed
@normanmaurer
normanmaurer deleted the auto-port-pr-18322-to-4.1 branch November 11, 2026 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants