# OOM Error

**URL:** https://discuss.elastic.co/t/oom-error/248154
**Category:** Elasticsearch
**Created:** [September 10, 2020, 11:16am UTC](https://discuss.elastic.co/t/oom-error/248154 "2020-09-10T11:16:10Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Shreesha\_Gundmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shreesha_gundmi/32/45398_2.png) [@Shreesha\_Gundmi](https://discuss.elastic.co/u/Shreesha_Gundmi)
#### Post date: [September 10, 2020, 11:16am UTC](https://discuss.elastic.co/t/oom-error/248154/1 "2020-09-10T11:16:10Z")

</div>

Hi Team,

I am using Elasticsearch 7.6.2, sometimes when we request query I am getting OOM (Out Of Memory) may I know how to tackle this issue?

Hardware environment as follows:  
Server capacity  
vCPUs: 8  
RAM: 32GB  
Storage: 100GB

> ES Health  
> "cluster\_name" : "elasticsearch",  
> "status" : "yellow",  
> "timed\_out" : false,  
> "number\_of\_nodes" : 1,  
> "number\_of\_data\_nodes" : 1,  
> "active\_primary\_shards" : 12,  
> "active\_shards" : 12,  
> "relocating\_shards" : 0,  
> "initializing\_shards" : 0,  
> "unassigned\_shards" : 12,  
> "delayed\_unassigned\_shards" : 0,  
> "number\_of\_pending\_tasks" : 0,  
> "number\_of\_in\_flight\_fetch" : 0,  
> "task\_max\_waiting\_in\_queue\_millis" : 0,  
> "active\_shards\_percent\_as\_number" : 50.0

> Elastic Version Details  
> "version" : {  
> "number" : "7.6.2",  
> "build\_flavor" : "default",  
> "build\_type" : "rpm",  
> "build\_hash" : "\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*",  
> "build\_date" : "2020-03-26T06:34:37.794943Z",  
> "build\_snapshot" : false,  
> "lucene\_version" : "8.4.0",  
> "minimum\_wire\_compatibility\_version" : "6.8.0",  
> "minimum\_index\_compatibility\_version" : "6.0.0-beta1"  
> },

memory allocated to ES is 20GB, but still getting OOM error sometimes, need to Restart ES every time. ☹

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [September 10, 2020, 7:59pm UTC](https://discuss.elastic.co/t/oom-error/248154/2 "2020-09-10T19:59:55Z")

</div>

Assuming Elasticsearch is the only thing running on the host it is recommended you give no more than 50% of available memory to the heap. You seem to have relatively little data in the cluster so it is surprising you are experiencing OOM.

What kind of workload is the cluster under?

Do you have any non-default cluster or index settings in place?

Do you have any third-party plugins installed?

Is there anything else running on that host?

---

<div class="post-metadata">

### Author: ![Shreesha\_Gundmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shreesha_gundmi/32/45398_2.png) [@Shreesha\_Gundmi](https://discuss.elastic.co/u/Shreesha_Gundmi)
#### Post date: [September 11, 2020, 5:04am UTC](https://discuss.elastic.co/t/oom-error/248154/3 "2020-09-11T05:04:52Z")

</div>

Hi @Christian_Dahlqvist,

Thank you for your response.

Here are some details:

We tried to allocate only 50% of server capacity, but OOM error frequency is height, if I allocate more memory then it will reduce displaying OOM frequency

> What kind of workload is the cluster under?  
> It is very Minimal workload, you can consider 2 to 3L data/day.

> Do you have any non-default cluster or index settings in place?  
> No, I don't have any non-default cluster or index setting.  
> Index setting as follows:  
> {"settings":  
> {"index":{"creation\_date":"1560427000684","  
> number\_of\_shards":"1",  
> "number\_of\_replicas":"1",  
> "uuid":"\*\*\*\*\*\*\*\*\*\*\*\*\*",  
> "version":{"created":"7010099","upgraded":"7060299"},  
> "provided\_name":"\*\*\*\*\*\*\*\*"}}}

> Do you have any third-party plugins installed?  
> No, we don't have any third-party plugins installed.

> Is there anything else running on that host?  
> yes, we have Web application hosted in the same server, but that Utilization is minimal.

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [September 11, 2020, 5:14am UTC](https://discuss.elastic.co/t/oom-error/248154/4 "2020-09-11T05:14:56Z")

</div>

Can you show the full output of the cluster stats API?

What is the OOM message? Do you see any long or slow GC in the logs?

---

<div class="post-metadata">

### Author: ![Shreesha\_Gundmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shreesha_gundmi/32/45398_2.png) [@Shreesha\_Gundmi](https://discuss.elastic.co/u/Shreesha_Gundmi)
#### Post date: [September 11, 2020, 8:05am UTC](https://discuss.elastic.co/t/oom-error/248154/5 "2020-09-11T08:05:07Z")

</div>

@Christian_Dahlqvist

I checked with GC Log, but I haven't seen any long or Slow logs

Here is the sample OOM Error Log from ES

> Elasticsearch Log  
> "type": "server",  
> "timestamp": "2020-08-31T16:28:42,673Z",  
> "level": "INFO",  
> "component": "o.e.n.Node",  
> "cluster.name": "elasticsearch",  
> "node.name": "ip-_ **-** -__-",  
> "message": "JVM arguments [-Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.locale.providers=COMPAT, -Xms20g, -Xmx20g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=100, -XX:+UseCMSInitiatingOccupancyOnly, -Djava.io.tmpdir=/tmp/elasticsearch-1422291560869168296, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=/var/lib/elasticsearch, -XX:ErrorFile=/var/log/elasticsearch/hs\_err\_pid%p.log, -Xlog:gc_,gc+age=trace,safepoint:file=/var/log/elasticsearch/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -XX:MaxDirectMemorySize=10737418240, -Des.path.home=/usr/share/elasticsearch, -Des.path.conf=/etc/elasticsearch, -Des.distribution.flavor=default, -Des.distribution.type=rpm, -Des.bundled\_jdk=true]"

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [September 11, 2020, 8:07am UTC](https://discuss.elastic.co/t/oom-error/248154/6 "2020-09-11T08:07:35Z")

</div>

Have you changed or updated any JVM options?

---

<div class="post-metadata">

### Author: ![Shreesha\_Gundmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shreesha_gundmi/32/45398_2.png) [@Shreesha\_Gundmi](https://discuss.elastic.co/u/Shreesha_Gundmi)
#### Post date: [September 11, 2020, 2:09pm UTC](https://discuss.elastic.co/t/oom-error/248154/7 "2020-09-11T14:09:56Z")

</div>

@Christian_Dahlqvist

Recently we modified only Xms and Xmx in JVM.options

> JVM.options as follows  
> ##JVM configuration##  
> #Xmx represents the maximum size of total heap space  
> -Xms20g  
> -Xmx20g  
> #GC configuration  
> 8-13:-XX:+UseConcMarkSweepGC  
> 8-13:-XX:CMSInitiatingOccupancyFraction=100  
> 8-13:-XX:+UseCMSInitiatingOccupancyOnly  
> 14-:-XX:+UseG1GC  
> 14-:-XX:G1ReservePercent=25  
> 14-:-XX:InitiatingHeapOccupancyPercent=30  
> #JVM temporary directory  
> -Djava.io.tmpdir=${ES\_TMPDIR}  
> ##heap dumps  
> #generate a heap dump when an allocation from the Java heap fails  
> #heap dumps are created in the working directory of the JVM  
> -XX:+HeapDumpOnOutOfMemoryError  
> #specify an alternative path for heap dumps; ensure the directory exists and  
> #has sufficient space  
> -XX:HeapDumpPath=/var/lib/elasticsearch  
> #specify an alternative path for JVM fatal error logs  
> -XX:ErrorFile=/var/log/elasticsearch/hs\_err\_pid%p.log  
> ##JDK 8 GC logging  
> 8:-XX:+PrintGCDetails  
> 8:-XX:+PrintGCDateStamps  
> 8:-XX:+PrintTenuringDistribution  
> 8:-XX:+PrintGCApplicationStoppedTime  
> 8:-Xloggc:/var/log/elasticsearch/gc.log  
> 8:-XX:+UseGCLogFileRotation  
> 8:-XX:NumberOfGCLogFiles=32  
> 8:-XX:GCLogFileSize=64m  
> #JDK 9+ GC logging  
> 9-:Xlog:gc\*,gc+age=trace,safepoint:file=/var/log/elasticsearch/gc.log:utctime,pid,tags:filecount=32,filesize=64m

---

<div class="post-metadata">

### Author: ![Shreesha\_Gundmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shreesha_gundmi/32/45398_2.png) [@Shreesha\_Gundmi](https://discuss.elastic.co/u/Shreesha_Gundmi)
#### Post date: [September 15, 2020, 2:44pm UTC](https://discuss.elastic.co/t/oom-error/248154/8 "2020-09-15T14:44:03Z")

</div>

@Christian_Dahlqvist

Any Update..?

---

<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: [October 13, 2020, 2:44pm UTC](https://discuss.elastic.co/t/oom-error/248154/9 "2020-10-13T14:44:04Z")

</div>

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