Skip to content

bugfix: fix IDENTIFIED_CHANNELS leak causing TC FullGC and OOM - #8224

Open
saul-c wants to merge 1 commit into
apache:2.xfrom
saul-c:fix/identified-channels-oom-2.x
Open

bugfix: fix IDENTIFIED_CHANNELS leak causing TC FullGC and OOM#8224
saul-c wants to merge 1 commit into
apache:2.xfrom
saul-c:fix/identified-channels-oom-2.x

Conversation

@saul-c

@saul-c saul-c commented Sep 12, 2026

Copy link
Copy Markdown

When TM/RM clients disconnect (e.g. K8s pod rolling update, HPA scaling), RpcContext.release() only nulled the clientIDHolderMap field instead of removing the dead channel from ChannelManager.IDENTIFIED_CHANNELS. Dead Netty channels (with RpcContext/pipeline/ByteBuf) accumulated forever until the TC ran into continuous FullGC and OOM.

  • RpcContext.release(): remove the channel from IDENTIFIED_CHANNELS
  • ChannelManager.releaseRpcContext(): remove the channel defensively
  • AbstractNettyRemotingServer.handleDisconnect: route through the unified releaseRpcContext entry (used by both READER_IDLE and channelInactive)
  • NettyClientChannelManager.releaseChannel(): release rpc context too
  • add ChannelManagerOOMTest reproducing repeated reconnect/disconnect

Ⅰ. Describe what this PR did

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

When TM/RM clients disconnect (e.g. K8s pod rolling update, HPA scaling),
RpcContext.release() only nulled the clientIDHolderMap field instead of
removing the dead channel from ChannelManager.IDENTIFIED_CHANNELS.
Dead Netty channels (with RpcContext/pipeline/ByteBuf) accumulated forever
until the TC ran into continuous FullGC and OOM.

- RpcContext.release(): remove the channel from IDENTIFIED_CHANNELS
- ChannelManager.releaseRpcContext(): remove the channel defensively
- AbstractNettyRemotingServer.handleDisconnect: route through the unified
  releaseRpcContext entry (used by both READER_IDLE and channelInactive)
- NettyClientChannelManager.releaseChannel(): release rpc context too
- add ChannelManagerOOMTest reproducing repeated reconnect/disconnect
@WangzJi WangzJi added the module/core core module label Sep 12, 2026
@WangzJi WangzJi added this to the 2.8.0 milestone Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants