Repository navigation
Auto-port 4.1: Release the handshake response when a WebSocket extension is rejected - #18329
Merged
Merged
Conversation
…#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)
✅ All tests passed ✅🏷️ Commit: eff423e 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.
Auto-port of #18322 to 4.1
Cherry-picked commit: bc6f58a
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.