[ 
https://issues.apache.org/jira/browse/RATIS-2416?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tsz-wo Sze updated RATIS-2416:
------------------------------
    Fix Version/s: 3.2.2
                       (was: 3.3.0)

> 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.2.2
>
>          Time Spent: 1h
>  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)

Reply via email to