Kibana JavaScript heap out of memory


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

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.

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.


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.

Just by running command export NODE_OPTIONS=--max_old_space_size=4096 will work

Yes, or prepending the command with it, see NodeJS docs for more details.


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.

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.

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.


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" {@}

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