# Kibana JavaScript heap out of memory

**URL:** <https://discuss.elastic.co/t/kibana-javascript-heap-out-of-memory/228365>\
**Category:** Kibana\
**Created:** [April 16, 2020, 4:09pm UTC](https://discuss.elastic.co/t/kibana-javascript-heap-out-of-memory/228365 "2020-04-16T16:09:23Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![chandu5565](https://avatars.discourse-cdn.com/v4/letter/c/c57346/32.png) [@chandu5565](https://discuss.elastic.co/u/chandu5565)\
**Post date:** [April 16, 2020, 4:09pm UTC](https://discuss.elastic.co/t/kibana-javascript-heap-out-of-memory/228365/1 "2020-04-16T16:09:23Z")

</div>

Hi,

While generating report in kibana am getting below error. How can i increase the heap memory for kibana.

```auto

log [13:01:39.659] [info][queue-job][reporting] Successfully queued job: k92rw1ad0xuh4e318d6raay8
log [13:04:46.929] [info][esqueue][queue-worker][reporting] k92ruhg00xuh4e318d0kxz12 - Job execution completed successfully

<--- Last few GCs --->

[43865:0x3e3f0c0] 289973 ms: Mark-sweep 1248.7 (1373.6) -> 1248.5 (1357.6) MB, 138.9 / 0.0 ms (average mu = 0.816, current mu = 0.001) last resort GC in old space requested
[43865:0x3e3f0c0] 290105 ms: Mark-sweep 1248.5 (1357.6) -> 1248.5 (1342.1) MB, 132.7 / 0.0 ms (average mu = 0.686, current mu = 0.000) last resort GC in old space requested

<--- JS stacktrace --->

==== JS stack trace =========================================

    0: ExitFrame [pc: 0x5512055be1d]
Security context: 0x2e789e19e6e1 <JSObject>
    1: substring [0x2e789e18e391](this=0x2e7b6e1ed161 <Very long string[287556309]>,0,1000)
    2: /* anonymous */ [0x15ab2b721081] [/usr/share/kibana/x-pack/legacy/plugins/reporting/server/lib/esqueue/worker.js:64] [bytecode=0x36c7b6bf84a1 offset=149](this=0x15ab2b71f479 <EventEmitter map = 0xf7f449c509>,msg=0x056b22ed1449 <String[50]: Failure saving job out...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: 0x8dc1c0 node::Abort() [/usr/share/kibana/bin/../node/bin/node]
 2: 0x8dc20c [/usr/share/kibana/bin/../node/bin/node]
 3: 0xad60ae v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/share/kibana/bin/../node/bin/node]
 4: 0xad62e4 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/share/kibana/bin/../node/bin/node]
 5: 0xec3972 [/usr/share/kibana/bin/../node/bin/node]
 6: 0xed318f v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/share/kibana/bin/../node/bin/node]
 7: 0xe9b3d5 [/usr/share/kibana/bin/../node/bin/node]
 8: 0xea2c4a v8::internal::Factory::NewRawOneByteString(int, v8::internal::PretenureFlag) [/usr/share/kibana/bin/../node/bin/node]
 9: 0xfec6ed v8::internal::String::SlowFlatten(v8::internal::Handle<v8::internal::ConsString>, v8::internal::PretenureFlag) [/usr/share/kibana/bin/../node/bin/node]
10: 0xad36d4 v8::internal::String::Flatten(v8::internal::Handle<v8::internal::String>, v8::internal::PretenureFlag) [/usr/share/kibana/bin/../node/bin/node]
11: 0xea422d v8::internal::Factory::NewProperSubString(v8::internal::Handle<v8::internal::String>, int, int) [/usr/share/kibana/bin/../node/bin/node]
12: 0x119032d v8::internal::Runtime_StringSubstring(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/share/kibana/bin/../node/bin/node]
13: 0x5512055be1d
Aborted (core dumped)
--->

```

help is really appreciated.

---

<div class="post-metadata">

**Author:** ![azasypkin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azasypkin/32/42216_2.png) [@azasypkin](https://discuss.elastic.co/u/azasypkin)\
**Post date:** [April 17, 2020, 3:06pm UTC](https://discuss.elastic.co/t/kibana-javascript-heap-out-of-memory/228365/2 "2020-04-17T15:06:44Z")

</div>

Hi @chandu5565,

It depends on how you run Kibana, but the most common way is to use env variable `NODE_OPTIONS=--max_old_space_size=4096`.

Best,  
Oleg

---

<div class="post-metadata">

**Author:** ![chandu5565](https://avatars.discourse-cdn.com/v4/letter/c/c57346/32.png) [@chandu5565](https://discuss.elastic.co/u/chandu5565)\
**Post date:** [April 20, 2020, 7:48am UTC](https://discuss.elastic.co/t/kibana-javascript-heap-out-of-memory/228365/3 "2020-04-20T07:48:53Z")

</div>

Sorry for late reply can you also tell me how can I use it. Just by running command export NODE\_OPTIONS=--max\_old\_space\_size=4096 will work or do I need to add it in some file.

---

<div class="post-metadata">

**Author:** ![azasypkin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azasypkin/32/42216_2.png) [@azasypkin](https://discuss.elastic.co/u/azasypkin)\
**Post date:** [April 20, 2020, 8:13am UTC](https://discuss.elastic.co/t/kibana-javascript-heap-out-of-memory/228365/4 "2020-04-20T08:13:03Z")

</div>

> Just by running command export NODE\_OPTIONS=--max\_old\_space\_size=4096 will work

Yes, or prepending the command with it, see [NodeJS docs](https://nodejs.org/api/cli.html#cli_node_options_options) for more details.

Best,  
Oleg

---

<div class="post-metadata">

**Author:** ![chandu5565](https://avatars.discourse-cdn.com/v4/letter/c/c57346/32.png) [@chandu5565](https://discuss.elastic.co/u/chandu5565)\
**Post date:** [April 20, 2020, 8:17am UTC](https://discuss.elastic.co/t/kibana-javascript-heap-out-of-memory/228365/5 "2020-04-20T08:17:18Z")

</div>

Thanks for your quick response but when am trying to download csv report which is generated kibana getting restarted. What would be the possible cause can you help me with this.

---

<div class="post-metadata">

**Author:** ![azasypkin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azasypkin/32/42216_2.png) [@azasypkin](https://discuss.elastic.co/u/azasypkin)\
**Post date:** [April 20, 2020, 8:25am UTC](https://discuss.elastic.co/t/kibana-javascript-heap-out-of-memory/228365/6 "2020-04-20T08:25:02Z")

</div>

We need Kibana verbose logs, the command you use to run Kibana, configuration or in other words as much info as possible. Otherwise it's impossible to guess what is wrong with your particular setup.

---

<div class="post-metadata">

**Author:** ![chandu5565](https://avatars.discourse-cdn.com/v4/letter/c/c57346/32.png) [@chandu5565](https://discuss.elastic.co/u/chandu5565)\
**Post date:** [May 6, 2020, 6:48am UTC](https://discuss.elastic.co/t/kibana-javascript-heap-out-of-memory/228365/7 "2020-05-06T06:48:47Z")

</div>

Thanks for your help azasypkin

I Found a solution for this JavaScript heap out of memory.

Am running kibana as root user so Initially I faced change to update it in /etc/default/kibana by adding below line.

NODE\_OPTIONS="--max-old-space-size=8192"

Then I made changes to kibana executable file i.e /bin/kibana and added --max-old-space-size=8192 to NODE\_OPTIONS like below.

NODE\_OPTIONS="--no-warnings --max-http-header-size=65536 --max-old-space-size=8192 {NODE\_OPTIONS}" NODE\_ENV=production exec "{NODE}" "{DIR}/src/cli" {@}

---

<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:** [June 3, 2020, 6:49am UTC](https://discuss.elastic.co/t/kibana-javascript-heap-out-of-memory/228365/8 "2020-06-03T06:49:00Z")

</div>

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