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 18:24:00 UTC

[jira] [Resolved] (RATIS-2417) Fix ChannelMap memory leak in DataStreamManagement when read() fails early

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

Tsz-wo Sze resolved RATIS-2417.
-------------------------------
    Fix Version/s: 3.3.0
       Resolution: Fixed

The pull request is now merged.  Thanks, [~slfan1989]!

> Fix ChannelMap memory leak in DataStreamManagement when read() fails early
> --------------------------------------------------------------------------
>
>                 Key: RATIS-2417
>                 URL: https://issues.apache.org/jira/browse/RATIS-2417
>             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 DataStreamManagement.read() throws an exception early (e.g., protocol parsing failure before readImpl() completes), the ChannelMap is not cleaned up properly. This causes the channelId -> invocationId mapping to accumulate in memory, leading to a memory leak.
>  
> Currently, only removeDataStream() is called in the exception handler, but channels.remove() is not invoked to clean up the ChannelMap entry.
>  
> *Solution*
>  
> 1. Extract ClientInvocationId and ChannelId calculation before calling readImpl()
> 2. In the read() exception handler, add channels.remove(channelId, key) to properly clean up ChannelMap



--
This message was sent by Atlassian Jira
(v8.20.10#820010)