Shilun Fan created RATIS-2417:
---------------------------------
Summary: 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
*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)