Skip to content

[Bug] Dubbo 3.3.6 trip protocol netty memory leak #16415

Open

Description

@zhongxiang

Pre-check

  • I am sure that all the content I provide is in English.

Search before asking

  • I had searched in the issues and found no similar issues.

Apache Dubbo Component

Java SDK (apache/dubbo)

Dubbo Version

dubbo-rpc-triple:3.3.6
Netty:4.2.9 use direct memory
jdk:17.0.17
windowns

Steps to reproduce this issue

@DubboReference(
version = "1.0.0",
url = "tri://${dubbo.directUrl}",
protocol = "tri",
check = false,
timeout = 100, // Set a shorter timeout to simulate a rpc timeout
connections = 5,
actives = 5
)
public void setTripleService(TripleExternalService tripleService) {
this.tripleService = tripleService;
}

note : add jvm property -Dio.netty.leakDetectionLevel=PARANOID
If you keep calling a certain method of this interface for a while, it will appear, and the smaller the timeout, the easier it is to reproduce.
output:

io.netty.buffer.AdvancedLeakAwareByteBuf.readByte(AdvancedLeakAwareByteBuf.java:401)
io.netty.handler.codec.http2.DefaultHttp2FrameReader.preProcessFrame(DefaultHttp2FrameReader.java:190)
io.netty.handler.codec.http2.DefaultHttp2FrameReader.readFrame(DefaultHttp2FrameReader.java:146)
io.netty.handler.codec.http2.Http2InboundFrameLogger.readFrame(Http2InboundFrameLogger.java:39)
io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder.decodeFrame(DefaultHttp2ConnectionDecoder.java:186)
io.netty.handler.codec.http2.DecoratingHttp2ConnectionDecoder.decodeFrame(DecoratingHttp2ConnectionDecoder.java:61)
io.netty.handler.codec.http2.Http2ConnectionHandler$FrameDecoder.decode(Http2ConnectionHandler.java:391)
io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:451)
io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:545)
io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:484)
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:356)
io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:293)
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:354)
io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1429)
io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:918)
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:172)
io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.handle(AbstractNioChannel.java:445)
io.netty.channel.nio.NioIoHandler$DefaultNioRegistration.handle(NioIoHandler.java:388)
io.netty.channel.nio.NioIoHandler.processSelectedKey(NioIoHandler.java:596)
io.netty.channel.nio.NioIoHandler.processSelectedKeysOptimized(NioIoHandler.java:571)
io.netty.channel.nio.NioIoHandler.processSelectedKeys(NioIoHandler.java:512)
io.netty.channel.nio.NioIoHandler.run(NioIoHandler.java:484)
io.netty.channel.SingleThreadIoEventLoop.runIo(SingleThreadIoEventLoop.java:225)
io.netty.channel.SingleThreadIoEventLoop.run(SingleThreadIoEventLoop.java:196)
io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:1195)
io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
java.base/java.lang.Thread.run(Thread.java:842)

What you expected to happen

I don't know if I used it wrong or if it's actually a bug

Anything else

No response

Do you have a (mini) reproduction demo?

  • Yes, I have a minimal reproduction demo to help resolve this issue more effectively!

Are you willing to submit a pull request to fix on your own?

  • Yes I am willing to submit a pull request on my own!

Code of Conduct

Activity

  1. added
    type/need-triage
    component/need-triage
    on Aug 7, 2026
  2. added
    help wanted
    and removed
    type/need-triage
    component/need-triage
    on Aug 12, 2026
  3. LeonxLJX commented on Sep 1, 2026

    @LeonxLJX

    I'd like to take this one — I'll follow up with a PR. (claiming via @LeonxLJX)

  4. LeonxLJX commented on Sep 1, 2026

    @LeonxLJX

    Hi! I'd like to investigate the Dubbo 3.3.6 trip protocol netty memory leak. Plan: reproduce, profile, fix the leak, add a test. May I be assigned?

  5. chaoyoung commented on Nov 10, 2026

    @chaoyoung
    Contributor

    Independently reproduced the same callback-executor ownership gap with released Dubbo 3.3.7, Netty 4.2.19.Final and OpenJDK 25. No custom transport SPI was loaded.

    The useful distinguishing sequence is a synchronous unary deadline before response headers:

    1. A real DeadlineFuture expires; AsyncRpcResult closes the per-call ThreadlessExecutor.
    2. UnaryClientCallListener.onStart has not run, so its timeout-cancellation listener has not yet been registered. The HTTP/2 stream can remain active.
    3. Response HEADERS and DATA are exchanged through paired Netty HTTP/2 codecs and multiplexed child channels.
    4. The real response handler submits DATA to SerializingExecutor, but the shutdown executor drops the task. The captured DATA buffer remains at refCnt=1, including after channel/decoder cleanup. The fixture manually releases it only after recording those observations.

    This corroborates the root cause described by #16418; I am not opening a competing fix PR. A regression that exercises an actual pre-header deadline and late codec-delivered DATA would complement the existing shutdown unit test. The paired-codec fixture still uses a mocked upper client-call listener; this is not a production-load measurement or a full TCP RPC benchmark.

    There is also a useful negative control: once local RST has actually been processed and exchanged, subsequent peer DATA writes fail and produce no client DATA callbacks. Directly injecting DATA after cancellation should not be presented as proof that it can arrive over a reset wire stream.

    I have not applied #16418 to this fixture, so this comment does not claim that the PR has been verified to cover all submission races or all cancellation behavior.

    Investigation and this summary were AI-assisted.

  6. LeonxLJX commented on Nov 12, 2026

    @LeonxLJX

    Claiming this. I'll take a look and submit a fix PR soon! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wanted

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions