Skip to content

[BUG] Java off-heap memory overflow (Direct Buffer Memory OOM) error #3964

@Doyle-net

Description

@Doyle-net

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Version used:1.7.3
Collector:4
Data collection tasks: 438
After running for a period of time, exceeding 8-9 hours, the following error occurred in the main program.

Java configuration for the main program,Memory allocated: 16GB
-XX:MaxDirectMemorySize=10g -Xms4g -Xmx4g -Dfile.encoding=UTF-8 -Doracle.jdbc.timezoneAsRegion=false --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED

Expected Behavior

No response

Steps To Reproduce

No response

Environment

HertzBeat version(s):1.7.3

Debug logs

2026-01-13 19:40:32.008 [595869159430144-system_data_anomaly-data_list-5347] ERROR org.apache.hertzbeat.collector.dispatch.WorkerPool Line:49 - Thread Name 595869159430144-system_data_anomaly-data_list-5347 : Cannot reserve 4194304 bytes of direct buffer memory (allocated: 10733664086, limit: 10737418240)
java.lang.OutOfMemoryError: Cannot reserve 4194304 bytes of direct buffer memory (allocated: 10733664086, limit: 10737418240)
at java.base/java.nio.Bits.reserveMemory(Bits.java:178)
at java.base/java.nio.DirectByteBuffer.(DirectByteBuffer.java:127)
at java.base/java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:360)
at io.netty.buffer.PoolArena$DirectArena.allocateDirect(PoolArena.java:718)
at io.netty.buffer.PoolArena$DirectArena.newChunk(PoolArena.java:693)
at io.netty.buffer.PoolArena.allocateNormal(PoolArena.java:213)
at io.netty.buffer.PoolArena.tcacheAllocateNormal(PoolArena.java:195)
at io.netty.buffer.PoolArena.allocate(PoolArena.java:137)
at io.netty.buffer.PoolArena.allocate(PoolArena.java:127)
at io.netty.buffer.PooledByteBufAllocatorL$InnerAllocator.newDirectBufferL(PooledByteBufAllocatorL.java:173)
at io.netty.buffer.PooledByteBufAllocatorL$InnerAllocator.directBuffer(PooledByteBufAllocatorL.java:206)
at io.netty.buffer.PooledByteBufAllocatorL.allocate(PooledByteBufAllocatorL.java:53)
at org.apache.arrow.memory.netty.NettyAllocationManager.(NettyAllocationManager.java:74)
at org.apache.arrow.memory.netty.NettyAllocationManager.(NettyAllocationManager.java:81)
at org.apache.arrow.memory.netty.NettyAllocationManager$1.create(NettyAllocationManager.java:38)
at org.apache.arrow.memory.BaseAllocator.newAllocationManager(BaseAllocator.java:376)
at org.apache.arrow.memory.BaseAllocator.newAllocationManager(BaseAllocator.java:372)
at org.apache.arrow.memory.BaseAllocator.bufferWithoutReservation(BaseAllocator.java:357)
at org.apache.arrow.memory.BaseAllocator.buffer(BaseAllocator.java:336)
at org.apache.arrow.memory.RootAllocator.buffer(RootAllocator.java:27)
at org.apache.arrow.memory.BaseAllocator.buffer(BaseAllocator.java:298)
at org.apache.arrow.memory.RootAllocator.buffer(RootAllocator.java:27)
at org.apache.arrow.vector.BaseVariableWidthVector.allocateBytes(BaseVariableWidthVector.java:498)
at org.apache.arrow.vector.BaseVariableWidthVector.allocateNew(BaseVariableWidthVector.java:446)
at org.apache.arrow.vector.BaseVariableWidthVector.allocateNew(BaseVariableWidthVector.java:407)
at org.apache.arrow.vector.VectorSchemaRoot.allocateNew(VectorSchemaRoot.java:150)
at org.apache.hertzbeat.common.entity.message.CollectRep$MetricsData$Builder.build(CollectRep.java:432)
at org.apache.hertzbeat.collector.dispatch.MetricsCollect.validateResponse(MetricsCollect.java:475)
at org.apache.hertzbeat.collector.dispatch.MetricsCollect.run(MetricsCollect.java:224)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    To do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions