Skip to content

Commit

Permalink
DRILL-8489: Sender memory leak when rpc encode exception (#2901)
Browse files Browse the repository at this point in the history
  • Loading branch information
shfshihuafeng authored May 1, 2024
1 parent dda5bc4 commit 6d94399
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected void encode(ChannelHandlerContext ctx, OutboundRpcMessage msg, List<Ob
msg.release();
return;
}

boolean encodeSucess = false;
try{
if (RpcConstants.EXTRA_DEBUGGING) {
logger.debug("Encoding outbound message {}", msg);
Expand Down Expand Up @@ -131,9 +131,13 @@ protected void encode(ChannelHandlerContext ctx, OutboundRpcMessage msg, List<Ob
if (RpcConstants.EXTRA_DEBUGGING) {
logger.debug("Sent message. Ending writer index was {}.", buf.writerIndex());
}
encodeSucess = true;
} finally {
// make sure to release Rpc Messages underlying byte buffers.
//msg.release();
//if msg instanceof ReferenceCounted,netty can release msg.
if (!encodeSucess) {
msg.release();
}
}
}

Expand Down

0 comments on commit 6d94399

Please sign in to comment.