Skip to content

Commit f53f03a

Browse files
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 <[email protected]>
1 parent 763266e commit f53f03a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/http/Http2ResponseHeaderCleanerHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
5151
super.channelRead(ctx, msg);
5252
} else {
5353
// Pass the message to the next handler in the pipeline
54-
ctx.fireChannelRead(msg);
54+
// Use super.channelRead to ensure proper reference counting
55+
super.channelRead(ctx, msg);
5556
}
5657
}
5758
}

0 commit comments

Comments
 (0)