# Logstash OutOfMemoryError: Direct buffer memory

**URL:** <https://discuss.elastic.co/t/logstash-outofmemoryerror-direct-buffer-memory/286473>\
**Category:** Logstash\
**Created:** [October 12, 2021, 10:27am UTC](https://discuss.elastic.co/t/logstash-outofmemoryerror-direct-buffer-memory/286473 "2021-10-12T10:27:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Muthu\_Ramachandran\_K](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/muthu_ramachandran_k/32/95724_2.png) [@Muthu\_Ramachandran\_K](https://discuss.elastic.co/u/Muthu_Ramachandran_K)\
**Post date:** [October 12, 2021, 10:27am UTC](https://discuss.elastic.co/t/logstash-outofmemoryerror-direct-buffer-memory/286473/1 "2021-10-12T10:27:06Z")

</div>

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) [?:?]

---

<div class="post-metadata">

**Author:** ![AquaX](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aquax/32/92006_2.png) [@AquaX](https://discuss.elastic.co/u/AquaX)\
**Post date:** [October 18, 2021, 2:21pm UTC](https://discuss.elastic.co/t/logstash-outofmemoryerror-direct-buffer-memory/286473/2 "2021-10-18T14:21:14Z")

</div>

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:

> **[JVM settings | Logstash Reference \[7.15\] | Elastic](https://www.elastic.co/guide/en/logstash/current/jvm-settings.html)**

---

<div class="post-metadata">

**Author:** ![Muthu\_Ramachandran\_K](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/muthu_ramachandran_k/32/95724_2.png) [@Muthu\_Ramachandran\_K](https://discuss.elastic.co/u/Muthu_Ramachandran_K)\
**Post date:** [October 19, 2021, 3:41am UTC](https://discuss.elastic.co/t/logstash-outofmemoryerror-direct-buffer-memory/286473/3 "2021-10-19T03:41:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 16, 2021, 3:41am UTC](https://discuss.elastic.co/t/logstash-outofmemoryerror-direct-buffer-memory/286473/4 "2021-11-16T03:41:36Z")

</div>

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