Skip to content

[Bug]Memory leak in Dubbo QoS module - ByteBuf not released in HttpCommandDecoder #15752

@xiaoqianbaobao

Description

@xiaoqianbaobao

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 Version: [3.2.18

Operating System: [e.g., Linux]

Java Version: [e.g., JDK 1.8.0_202]

Steps to reproduce this issue

We are experiencing memory leaks in the Dubbo QoS module, specifically in the HttpCommandDecoder class. The leak is caused by ByteBuf objects not being properly released when processing HTTP requests through the QoS interface.

the Error Logs:

[2025-11-02 08:56:45.424][ERROR][io.netty.util.ResourceLeakDetector][LEAK: ByteBuf.release() was not called before it's garbage-collected.
Recent access records:
Created at:
io.netty.buffer.PooledByteBufAllocator.newDirectBuffer(PooledByteBufAllocator.java:403)
io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:188)
io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:179)
io.netty.buffer.AbstractByteBufAllocator.buffer(AbstractByteBufAllocator.java:116)
io.netty.handler.codec.http.multipart.HttpPostStandardRequestDecoder.offer(HttpPostStandardRequestDecoder.java:295)
io.netty.handler.codec.http.multipart.HttpPostStandardRequestDecoder.(HttpPostStandardRequestDecoder.java:158)
io.netty.handler.codec.http.multipart.HttpPostRequestDecoder.(HttpPostRequestDecoder.java:95)
io.netty.handler.codec.http.multipart.HttpPostRequestDecoder.(HttpPostRequestDecoder.java:53)
org.apache.dubbo.qos.command.decoder.HttpCommandDecoder.decode(HttpCommandDecoder.java:58)
org.apache.dubbo.qos.server.handler.HttpProcessHandler.channelRead0(HttpProcessHandler.java:89)

Image Image

What you expected to happen

The memory leak occurs in:

org.apache.dubbo.qos.command.decoder.HttpCommandDecoder.decode() at line 58

When creating HttpPostRequestDecoder for HTTP command processing

The allocated Direct ByteBuf objects are not properly released in certain code paths

Anything else

The memory leak is triggered whenever someone executes any QoS-related command on a production machine.

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

Metadata

Metadata

Assignees

Labels

help wantedEverything needs help from contributorstype/bugBugs to being fixed

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions