question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Node v4.2.6 - FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory

See original GitHub issue

hey there -

i’m hitting the following error after upgrading to node v4 LTS.

02 02 2016 11:13:08.092:INFO [karma]: Karma v0.13.19 server started at http://localhost:9876/
02 02 2016 11:13:08.122:INFO [launcher]: Starting browser PhantomJS

<--- Last few GCs --->

    22555 ms: Scavenge 1441.4 (1502.2) -> 1441.4 (1502.2) MB, 1.6 / 0 ms (+ 2.4 ms in 1 steps since last GC) [allocation failure] [incremental marking delaying mark-sweep].
    22610 ms: Mark-sweep 1441.4 (1502.2) -> 1441.2 (1502.2) MB, 55.5 / 0 ms (+ 3.6 ms in 2 steps since start of marking, biggest step 2.4 ms) [last resort gc].
    22664 ms: Mark-sweep 1441.2 (1502.2) -> 1441.2 (1502.2) MB, 54.0 / 0 ms [last resort gc].


<--- JS stacktrace --->

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

Security context: 0x3acf8b8b4629 <JS Object>
    1: exec [native regexp.js:~85] [pc=0x1ab48201d158] (this=0x3477de668ed1 <JS RegExp>,k=0x1dc821cffa39 <String[106]: Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/538.1 (KHTML, like Gecko) PhantomJS/2.1.1 Safari/538.1>)
    2: parse [/path/to/my/project/node_modules/karma/node_modules/useragent/index.js:427] [pc=0x1ab4821e1cbf] (this=0x276f61054869 <JS Funct...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
Abort trap: 6`

Likewise, i see a similar error when running tests in chrome:

>>karma start
02 02 2016 11:49:26.366:WARN [karma]: No captured browser, open http://localhost:9876/
02 02 2016 11:49:26.447:INFO [karma]: Karma v0.13.19 server started at http://localhost:9876/
02 02 2016 11:49:26.455:INFO [launcher]: Starting browser Chrome

<--- Last few GCs --->

21051 ms: Mark-sweep 1429.9 (1488.2) -> 1429.4 (1488.2) MB, 26.3 / 0 ms (+ 124.4 ms in 20 steps since start of marking, biggest step 82.2 ms) [allocation failure] [GC in old space requested].
21163 ms: Mark-sweep 1429.4 (1488.2) -> 1429.4 (1488.2) MB, 110.6 / 0 ms [last resort gc].
21298 ms: Mark-sweep 1429.4 (1488.2) -> 1429.3 (1488.2) MB, 135.5 / 0 ms [last resort gc].


<--- JS stacktrace --->

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

Security context: 0x24bd825b4629 <JS Object>
    2: decodeURIComponent(aka decodeURIComponent) [native uri.js:248] [pc=0x2575a442da41] (this=0x24bd825041b9 <undefined>,W=0x111d0ab40cd9 <String[2]: id>)
    3: /* anonymous */(aka /* anonymous */) [querystring.js:83] [pc=0x2575a4426aee] (this=0x24bd825041b9 <undefined>,s=0x111d0ab40cd9 <String[2]: id>,decodeSpaces=0x24bd825041b9 <undefined>)
    4: arguments adaptor frame: 1->2
    5: decod...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
Abort trap: 6

My environment:

  • node: v4.2.6
  • phantomjs: v1.9.8
  • karma: v0.13.19
  • karma-phantomjs-launcher: v0.2.3
  • karma-chrome-launcher: v0.2.2
  • karma-chai: v0.1.0
  • karma-mocha: v0.2.1
  • karma-sinon: v1.0.4
  • karma-sourcemap-loader: v0.3.7
  • karma-webpack: v1.7.0
  • webpack: v1.12.12

I tried updating to the latest phantomjs but the error persisted - upgrades:

Running under the old configuration works fine:

  • node: v0.10.41
  • phantomjs: v1.9.8
  • karma: v0.13.19
  • karma-phantomjs-launcher: v0.2.3
  • karma-chrome-launcher: v0.2.2
  • karma-chai: v0.1.0
  • karma-mocha: v0.2.1
  • karma-sinon: v1.0.4
  • karma-sourcemap-loader: v0.3.7
  • karma-webpack: v1.7.0
  • webpack: v1.12.12

I’m on os-x v10.10.5

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:14
  • Comments:38 (11 by maintainers)

github_iconTop GitHub Comments

19reactions
pbiocommented, Jan 25, 2017

If others are having this issue still, I solved it buy using

node --max_old_space_size=4096 node_modules/karma/bin/karma start

instead of

karma start

Make sure karma is included in your project’s node_modules.

9reactions
stevemaocommented, Mar 6, 2018

another workaround is:

  1. Create a test loader file: loadtests.js
  2. require all the tests in loadtests.js
const testsContext = require.context('./src', true, /\.spec\.js$/);
testsContext.keys().forEach(testsContext);
  1. Include loadtests.js in karma.conf.js
files: [
      'loadtests.js',
],
preprocessors: {
      'loadtests.js': ['webpack', 'coverage'],
},
Read more comments on GitHub >

github_iconTop Results From Across the Web

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed ...
I have update Meteor to 1.4.2.3 but on server show error : FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory ......
Read more >
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed ...
Hi @estebanpdl, The solution to run your Node.js app with increased memory is to start the process with an additional V8 flag: --max-old-space-size....
Read more >
Node.js Memory Error on Mac Using M1: Grouparoo Blog
FATAL ERROR : wasm code commit Allocation failed - process out of memory. It began occurring regularly enough that I started digging.
Read more >
How to fix the following build error in travis-ci: FATAL ERROR ...
FATAL ERROR : CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory. You can find the full project source code at react-hot- ...
Read more >
Bitbucket Pipeline fails with: JavaScript heap out of memory
FATAL ERROR : CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory <--- Last few GCs ... By default the memory limit in...
Read more >

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found