Repository navigation
Release the handshake response when a WebSocket extension is rejected - #18322
Merged
normanmaurer merged 1 commit intoNov 10, 2026
Merged
normanmaurer merged 1 commit into
normanmaurer merged 1 commit into
Conversation
Motivation: WebSocketClientExtensionHandler throws CodecException when the server accepts an extension the client did not offer, but it keeps the FullHttpResponse referenced. The pipeline does not release a message when a handler throws, so the content buffer leaks. Modification: Release the response with ReferenceCountUtil before throwing, matching WebSocketServerExtensionHandler. Result: The response is released and the leak is gone.
🚨 All tests passed but jobs failed 🚨Failed Jobs without Test Failures❌ Auto-port to 5.0 / Auto-porting to 5.0 🏷️ Commit: 27dd1f4 Rerun ControlsClick the checkbox to trigger a rerun:
Learn more about TestLens at testlens.app/docs. |
Contributor
|
Could not create auto-port PR. |
Contributor
|
Auto-port PR for 4.1: #18329 |
Member
|
Ported to 5.0 in #18330. The cherry-pick had an import conflict, so it needed a manual port. |
normanmaurer
added a commit
that referenced
this pull request
Nov 10, 2026
…s rejected (#18322) (#18330) 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) Co-authored-by: LHY_CODE <[email protected]>
normanmaurer
added a commit
that referenced
this pull request
Nov 11, 2026
…ion is rejected (#18329) 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. --------- Co-authored-by: LHY_CODE <[email protected]> Co-authored-by: Norman Maurer <[email protected]>
He-Pin
added a commit
to He-Pin/incubator-pekko-http
that referenced
this pull request
Nov 17, 2026
Motivation: The client should not silently accept an unsupported selected extension. An empty response header, however, does not select an extension and should not prevent an otherwise ordinary WebSocket connection. Modification: Retain the existing nonempty extension selection check. Treat an empty or HTTP-OWS-only response header as no selection. Add positive handshake and text-echo tests for both forms, and document the distinction. Result: Blank extension response headers allow ordinary WebSocket exchanges. Nonempty selection handling is unchanged by this follow-up. PJ's separate request to preserve explicitly offered framing-neutral extensions remains an unresolved API-policy question; this is not a complete review resolution. Tests: - Offline Scala 2.13.18 compilation of changed Handshake.scala and WebSocketClientSpec.scala against cached existing module classes: passed. - Direct ScalaTest WebSocketClientSpec, filtered to "extension response value": 2 positive tests passed using those compiled classes and cached dependencies. This is not a clean full-project build or Scala 3 result. - Cached official scalafmt 3.11.5 applied to the two changed Scala files. - git diff --check: passed. - Full suite, MiMa, docs/paradox and CI were not run for this revision. References: Refs apache#1436 and PJ Fanning review 5938857123. RFC 6455 section 4.1 item 5. Original investigation: netty/netty#18322.
pjfanning
pushed a commit
to He-Pin/incubator-pekko-http
that referenced
this pull request
Nov 17, 2026
Motivation: The client should not silently accept an unsupported selected extension. An empty response header, however, does not select an extension and should not prevent an otherwise ordinary WebSocket connection. Modification: Retain the existing nonempty extension selection check. Treat an empty or HTTP-OWS-only response header as no selection. Add positive handshake and text-echo tests for both forms, and document the distinction. Result: Blank extension response headers allow ordinary WebSocket exchanges. Nonempty selection handling is unchanged by this follow-up. PJ's separate request to preserve explicitly offered framing-neutral extensions remains an unresolved API-policy question; this is not a complete review resolution. Tests: - Offline Scala 2.13.18 compilation of changed Handshake.scala and WebSocketClientSpec.scala against cached existing module classes: passed. - Direct ScalaTest WebSocketClientSpec, filtered to "extension response value": 2 positive tests passed using those compiled classes and cached dependencies. This is not a clean full-project build or Scala 3 result. - Cached official scalafmt 3.11.5 applied to the two changed Scala files. - git diff --check: passed. - Full suite, MiMa, docs/paradox and CI were not run for this revision. References: Refs apache#1436 and PJ Fanning review 5938857123. RFC 6455 section 4.1 item 5. Original investigation: netty/netty#18322.
ikpil
added a commit
to ikpil/Netty.NET
that referenced
this pull request
Nov 29, 2026
…is rejected (netty/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/netty#18318. Upstream-Commit: netty/netty@bc6f58a
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation:
WebSocketClientExtensionHandlerthrowsCodecExceptionwhen the server accepts an extension that the client did not offer, but it keeps theFullHttpResponsereferenced. The pipeline does not release a message when a handler throws, so the response content buffer leaks.WebSocketServerExtensionHandleralready releases the request before throwing in the same situation.Modification:
Release the response with
ReferenceCountUtilbefore throwing theCodecException.Result:
The handshake response is released and the leak is gone. Added a regression test that feeds a
FullHttpResponsenaming an unaccepted extension and asserts the responserefCntdrops to 0.Fixes #18318.