# Java.lang.OutOfMemoryError after trying to garbage collect for 20 minutes

**URL:** <https://discuss.elastic.co/t/java-lang-outofmemoryerror-after-trying-to-garbage-collect-for-20-minutes/34510>\
**Category:** Elasticsearch\
**Created:** [November 13, 2015, 11:47am UTC](https://discuss.elastic.co/t/java-lang-outofmemoryerror-after-trying-to-garbage-collect-for-20-minutes/34510 "2015-11-13T11:47:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Suny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suny/32/22082_2.png) [@Suny](https://discuss.elastic.co/u/Suny)\
**Post date:** [November 13, 2015, 11:47am UTC](https://discuss.elastic.co/t/java-lang-outofmemoryerror-after-trying-to-garbage-collect-for-20-minutes/34510/1 "2015-11-13T11:47:13Z")

</div>

Hi. Our cluster crashed with OOM yesterday at 13:00 , with

> java.lang.OutOfMemoryError: Java heap space  
> at org.elasticsearch.common.compress.BufferRecycler.allocDecodeBuffer(BufferRecycler.java:137)  
> at org.elasticsearch.common.compress.lzf.LZFCompressedStreamInput.(LZFCompressedStreamInput.java:46)  
> ...

It looks like the node desperately tried to garbage collect memory from 12:40 on, both old and young generation, but without much success. The collection preceding the OOM was

> [2015-11-12 13:00:06,312][WARN][monitor.jvm] [xxx] [gc][old][3121308][923] duration [11.6s], collections [1]/[11.6s], total [11.6s]/[10.3m], memory [29.8gb]-\>[29.8gb]/[29.9gb], all\_pools {[young] [819.2mb]-\>[819.2mb]/[819.2mb]}{[survivor] [82.7mb]-\>[101.5mb]/[102.3mb]}{[old] [28.9gb]-\>[29gb]/[29gb]}

elasticsearch version "1.6.0"  
java version "1.8.0\_45"  
-XX:+UseParNewGC  
-XX:+UseConcMarkSweepGC  
-XX:+DisableExplicitGC  
-Xms30g -Xmx30g

We don't have much insight into the situation before the crash, sadly. The cluster is in production and ran fine for many months, it's part of an ELK stack.  
Our mapping says `"doc_values" : true` for nearly everything.

---

<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:** [July 5, 2017, 11:38pm UTC](https://discuss.elastic.co/t/java-lang-outofmemoryerror-after-trying-to-garbage-collect-for-20-minutes/34510/2 "2017-07-05T23:38:38Z")

</div>

Closed on July 5, 2017, 11:38pm UTC


