From 763266e6d72b36330e120b51d3d69ccd322c65c5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 14 Nov 2025 23:02:05 +0000 Subject: [PATCH 1/2] Initial plan From f53f03a297c3230b794bfb12a08b1a555e3d4600 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 14 Nov 2025 23:07:06 +0000 Subject: [PATCH 2/2] Fix Netty buffer leak in Http2ResponseHeaderCleanerHandler The issue was in the else block of channelRead() method. Using ctx.fireChannelRead(msg) directly bypasses the parent class's reference counting logic. Changed to use super.channelRead(ctx, msg) to ensure proper buffer lifecycle management. This ensures that when messages other than Http2HeadersFrame, Http2SettingsAckFrame, or Http2SettingsFrame are received, they are properly handled with correct reference counting, preventing ByteBuf leaks in HTTP/2 communication. Co-authored-by: FabianMeiswinkel <19165014+FabianMeiswinkel@users.noreply.github.com> --- .../implementation/http/Http2ResponseHeaderCleanerHandler.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/http/Http2ResponseHeaderCleanerHandler.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/http/Http2ResponseHeaderCleanerHandler.java index ce3204954783..709a77059c11 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/http/Http2ResponseHeaderCleanerHandler.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/http/Http2ResponseHeaderCleanerHandler.java @@ -51,7 +51,8 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception super.channelRead(ctx, msg); } else { // Pass the message to the next handler in the pipeline - ctx.fireChannelRead(msg); + // Use super.channelRead to ensure proper reference counting + super.channelRead(ctx, msg); } } }