Logstash OutOfMemoryError: Direct buffer memory

Hi,
we are using filebeat-> logstash -> elastic setup. The set up was working fine without any issues, but recently we noticed that logstash is going down frequently and we could see the below error. can anyone suggest how to troubleshoot this issue?

OutOfMemoryError: Direct buffer memory
2021-10-12T15:48:42.015+05:30 java.lang.OutOfMemoryError: Direct buffer memory

2021-10-12T15:48:42.015+05:30 at java.nio.Bits.reserveMemory(Bits.java:175) ~[?:?]

2021-10-12T15:48:42.015+05:30 at java.nio.DirectByteBuffer.(DirectByteBuffer.java:118) ~[?:?]

2021-10-12T15:48:42.015+05:30 at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:317) ~[?:?]

2021-10-12T15:48:42.015+05:30 at io.netty.buffer.PoolArena$DirectArena.allocateDirect(PoolArena.java:632) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]

2021-10-12T15:48:42.015+05:30 at io.netty.buffer.PoolArena$DirectArena.newUnpooledChunk(PoolArena.java:621) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]

2021-10-12T15:48:42.015+05:30 at io.netty.buffer.PoolArena.allocateHuge(PoolArena.java:213) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]

2021-10-12T15:48:42.015+05:30 at io.netty.buffer.PoolArena.allocate(PoolArena.java:141) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]

2021-10-12T15:48:42.015+05:30 at io.netty.buffer.PoolArena.reallocate(PoolArena.java:286) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]

2021-10-12T15:48:42.015+05:30 at io.netty.buffer.PooledByteBuf.capacity(PooledByteBuf.java:118) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]

2021-10-12T15:48:42.015+05:30 at io.netty.buffer.AbstractByteBuf.ensureWritable0(AbstractByteBuf.java:305) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]

2021-10-12T15:48:42.015+05:30 at io.netty.buffer.AbstractByteBuf.ensureWritable(AbstractByteBuf.java:280) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]

2021-10-12T15:48:42.015+05:30 at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1103) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]

2021-10-12T15:48:42.015+05:30 at io.netty.handler.codec.ByteToMessageDecoder$1.cumulate(ByteToMessageDecoder.java:99) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]

2021-10-12T15:48:42.015+05:30 at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:274) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]

2021-10-12T15:48:42.015+05:30 at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]

2021-10-12T15:48:42.015+05:30 at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:61) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]

2021-10-12T15:48:42.015+05:30 at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:370) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]

2021-10-12T15:48:42.015+05:30 at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:66) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]

2021-10-12T15:48:42.015+05:30 at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) [netty-all-4.1.65.Final.jar:4.1.65.Final]

2021-10-12T15:48:42.015+05:30 at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [netty-all-4.1.65.Final.jar:4.1.65.Final]

2021-10-12T15:48:42.015+05:30 at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [netty-all-4.1.65.Final.jar:4.1.65.Final]

2021-10-12T15:48:42.015+05:30 at java.lang.Thread.run(Thread.java:829) [?:?]

1 Like

Looks like you're running out of memory.
You should increase the amount of memory you have allocated to your host/jvm.
See this post for reference:

1 Like

Thank you Andreas Helmer. we increased the memory to solve this issue.

2 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.