karma: Node v4.2.6 - FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
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:
- phantomjs phantomjs-prebuilt: v2.1.1
- karma-phantomjs-launcher: v1.0.0
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
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 14
- Comments: 38 (11 by maintainers)
Commits related to this issue
- Improve karma conf in order to find solution for test run crashing Although the test are passing, the process crash with error Assertion failed: (0), function uv_close, file ../deps/uv/src/unix/core... — committed to rija/tdd-vuejs-frontend-webpack by deleted user 5 years ago
- ui: Fix OOM exception while building tests This exception was fixed in past and that time main root cause was tied to Helmet library. Now this OOM exception more likely is caused by increasing code ... — committed to cockroachdb/cockroach by koorosh 4 years ago
- Merge #46047 #46132 #46179 46047: ui: Fix OOM exception while building Karma tests r=dhartunian a=koorosh This exception was fixed in past and that time main root cause was tied to Helmet library. ... — committed to cockroachdb/cockroach by deleted user 4 years ago
- ui: (fix) OOM exception on ui-test build It is one more attempt to fix OOM issue on ui test runs. Previous fixes were based mainly on suggestion that the root cause of issue is source maps generated ... — committed to koorosh/cockroach by koorosh 4 years ago
- Merge #46640 46640: ui: (fix) OOM exception on ui-test build r=nathanstilwell a=koorosh It is one more attempt to fix OOM issue on ui test runs. Previous fixes were based mainly on suggestion that ... — committed to cockroachdb/cockroach by deleted user 4 years ago
If others are having this issue still, I solved it buy using
node --max_old_space_size=4096 node_modules/karma/bin/karma startinstead of
karma startMake sure karma is included in your project’s node_modules.
another workaround is:
loadtests.jsrequireall the tests inloadtests.jsloadtests.jsinkarma.conf.jsI found that with a growing number of tests, this was a problem even though I allocated more memory with the flag --max_old_space_size=4096
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
Removing source mapping as defined here: https://webpack.github.io/docs/usage-with-karma.html#source-maps helped get over this
karma.conf.js
webpack: { // devtool: ‘inline-source-map’,
Good luck out there!
I used --max_old_space_size and I again got the memory error. After doing some online research i realized it not underscore but dash like --max-old-space-size
When using
gulpthis works fine:@ianks just wondering if this is related to karma-sourcemap-loader plugin? same setup except it’s angular 2 project with TS
to avoid the above comments confuse people in the future
karma start karma.conf.js --max_old_space_size=4096does NOT work andnode --max_old_space_size=4096 node_modules/karma/bin/karma startworksAt least for me.
@stevemao’s solution is the only one that worked for me. Setting max_old_space_size to 4096 did not help (we have about 1500 tests).
@dignifiedquire do you need any additional info? I faced the same issue