Node: get error 'CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory'

Created on 30 Dec 2016  路  2Comments  路  Source: nodejs/node

  • Version:v6.9.1
  • Platform: centos 7.2
  • Subsystem: elasticdump

i use a tools which base on nodejs , try to import a 4G json file to elasticsearch, but get error as bellow:
please help me check.
<--- Last few GCs --->

1105107 ms: Mark-sweep 1381.6 (1434.0) -> 1381.6 (1434.0) MB, 1007.2 / 0.0 ms [allocation failure] [GC in old space requested].
1106118 ms: Mark-sweep 1381.6 (1434.0) -> 1381.6 (1418.0) MB, 1010.4 / 0.0 ms [last resort gc].
1107127 ms: Mark-sweep 1381.6 (1418.0) -> 1381.6 (1418.0) MB, 1009.4 / 0.0 ms [last resort gc].

<--- JS stacktrace --->

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

Security context: 0x24db061cfb51
2: write [/usr/lib/node_modules/elasticdump/node_modules/jsonparse/jsonparse.js:~80] [pc=0x13ec31b0a69e] (this=0x298a25564829 ,buffer=0xd7dfa04b791 )
3: /* anonymous */ [/usr/lib/node_modules/elasticdump/node_modules/JSONStream/index.js:23] [pc=0x13ec319ec313] (this=0x298a25564999
...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node::Abort() [node]
2: 0xdecf4c [node]
3: v8::Utils::ReportApiFailure(char const, char const) [node]
4: v8::internal::V8::FatalProcessOutOfMemory(char const, bool) [node]
5: v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [node]
6: v8::internal::Runtime_AllocateInTargetSpace(int, v8::internal::Object
, v8::internal::Isolate) [node]
7: 0x13ec315079a7
Aborted (core dumped)

All 2 comments

See https://github.com/nodejs/node/issues/10118, you're probably just running out of heap space (defaults to around 1.5 Gb), you can increase it with node --max_old_space_size=5120 script.js and see if that works (you'd need at least 5Gb of System Memory).

thanks, it is working for me ,
command: node --max_old_space_size=8192 /usr/bin/elasticdump *

Was this page helpful?
0 / 5 - 0 ratings