You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "Tsz-wo Sze (Jira)" <ji...@apache.org> on 2026/02/24 02:11:00 UTC
[jira] [Resolved] (RATIS-2416) Fix memory leak in NettyClientReplies for stale replies
[ https://issues.apache.org/jira/browse/RATIS-2416?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tsz-wo Sze resolved RATIS-2416.
-------------------------------
Fix Version/s: 3.3.0
Resolution: Fixed
The pull request is now merged. Thanks, [~slfan1989]!
> Fix memory leak in NettyClientReplies for stale replies
> -------------------------------------------------------
>
> Key: RATIS-2416
> URL: https://issues.apache.org/jira/browse/RATIS-2416
> Project: Ratis
> Issue Type: Bug
> Components: Netty
> Reporter: Shilun Fan
> Assignee: Shilun Fan
> Priority: Major
> Fix For: 3.3.0
>
> Time Spent: 50m
> Remaining Estimate: 0h
>
> *Problem:*
> When {{NettyClientStreamRpc.channelRead()}} receives an unknown/invalid reply (a reply without a corresponding request), it creates an empty in the ConcurrentHashMap that is never removed, causing a memory leak over time.
> *Root Cause:*
> - {{channelRead()}} calls for every received reply {{replies.getReplyMap(clientInvocationId)}}
> - {{getReplyMap()}} uses {{computeIfAbsent}} which creates a new empty map if the invocation ID doesn't exist
> - When the reply is unknown, {{receiveReply()}} finds {{replyEntry == null}} and returns early
> - The empty map remains in memory permanently
--
This message was sent by Atlassian Jira
(v8.20.10#820010)