Repository navigation
Port 5.0: Release the handshake response when a WebSocket extension is rejected (#18322) - #18330
Merged
Merged
Conversation
…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)
🚨 All tests passed but jobs failed 🚨Failed Jobs without Test Failures❌ Build PR / linux-x86_64-java25-awslc build 🏷️ Commit: c4c37b0 Rerun ControlsClick the checkbox to trigger a rerun:
Learn more about TestLens at testlens.app/docs. |
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 theserver accepts an extension that the client did not offer, but it keeps
the
FullHttpResponsereferenced. The pipeline does not release amessage when a handler throws, so the response content buffer leaks.
WebSocketServerExtensionHandleralready releases the request beforethrowing 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 unacceptedextension and asserts the response
refCntdrops to 0.Fixes #18318.
Port notes: resolved an import conflict with CompletionHandler, and the
test declares
throws Exceptionbecause EmbeddedChannel.finishAndReleaseAll()throws a checked exception on 5.0.
(cherry picked from commit bc6f58a)