Skip to content

Port 5.0: Release the handshake response when a WebSocket extension is rejected (#18322) - #18330

Merged
normanmaurer merged 1 commit into
netty:5.0from
normanmaurer:port5-18322
Nov 10, 2026
Merged

normanmaurer merged 1 commit into
netty:5.0from
normanmaurer:port5-18322

Conversation

@normanmaurer

Copy link
Copy Markdown
Member

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.

Port notes: resolved an import conflict with CompletionHandler, and the
test declares throws Exception because EmbeddedChannel.finishAndReleaseAll()
throws a checked exception on 5.0.

(cherry picked from commit bc6f58a)

…s rejected (netty#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 netty#18318.

Port notes: resolved an import conflict with CompletionHandler, and the
test declares `throws Exception` because EmbeddedChannel.finishAndReleaseAll()
throws a checked exception on 5.0.

(cherry picked from commit bc6f58a)
@testlens-app

testlens-app Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

🚨 All tests passed but jobs failed 🚨

Failed Jobs without Test Failures

❌ Build PR / linux-x86_64-java25-awslc build

🏷️ Commit: c4c37b0
▶️ Tests: 76420 executed
⚪️ Checks: 20/20 completed

Rerun Controls

Click the checkbox to trigger a rerun:

  • Rerun jobs

Learn more about TestLens at testlens.app/docs.

@normanmaurer
normanmaurer merged commit 363c9d8 into netty:5.0 Nov 10, 2026
20 of 21 checks passed
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.

2 participants