# Logstash - OutOfMemoryError from TCP input

**URL:** <https://discuss.elastic.co/t/logstash-outofmemoryerror-from-tcp-input/291702>\
**Category:** Logstash\
**Created:** [December 13, 2021, 6:14pm UTC](https://discuss.elastic.co/t/logstash-outofmemoryerror-from-tcp-input/291702 "2021-12-13T18:14:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vishnug](https://avatars.discourse-cdn.com/v4/letter/v/34f0e0/32.png) [@vishnug](https://discuss.elastic.co/u/vishnug)\
**Post date:** [December 13, 2021, 6:14pm UTC](https://discuss.elastic.co/t/logstash-outofmemoryerror-from-tcp-input/291702/1 "2021-12-13T18:14:02Z")

</div>

Hi,

I have a logstash pipeline that uses TCP as input. The pipeline handles around 150k to 200k events per day. I was getting the below errors.

```auto
An exception was thrown by org.logstash.tcp.InputLoop$InputHandler$FlushOnCloseListner.operationComplete()
java.lang.OutOfMemoryError: Java heap space

```

Logstash version - 7.9.3  
TCP plugin - 6.0.6

Workers - 1  
Batch Size - 500  
Heap size - 512mb

can anyone help me with this?

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [December 13, 2021, 6:38pm UTC](https://discuss.elastic.co/t/logstash-outofmemoryerror-from-tcp-input/291702/2 "2021-12-13T18:38:38Z")

</div>

Is this the only pipeline you have in your instance?

You have a large batch size for a small heap size, the default batch size is `125`, increasing the batch size also increases the memory overhead.

You should decrease your batch size or increase your heap size.

---

<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:** [January 10, 2022, 6:39pm UTC](https://discuss.elastic.co/t/logstash-outofmemoryerror-from-tcp-input/291702/3 "2022-01-10T18:39:28Z")

</div>

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