-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node v4.2.6 - FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory #1868
Comments
more info: if i limit the number of test files - e.g. instead of:
i use:
both chrome and phantomjs run the reduced test suite fine. not headline news i realize but still :-D is there a way to set the V8 option edit: fwiw, looks like i can run ~800 |
fwiw, my work-around is to run karma as a child process using the public api - this allows me to set the
and then in the worker:
there's some additional fiddly bits around error / disconnect handling, etc but this is the basic gist. only thing i'm missing at the moment is colored output - for whatever reason the only messages that retain their color (green) are 'karma started', 'starting browser', and 'connected' messages (the first 3 you typically see during a run). |
I'm not sure but have you tried |
re: memory consumption - comparing node v4 LTS to v0.10.41 i see similar memory use. v0.10.41 maxes out at ~1.9gb, node v4 at ~2.3gb. in both cases, that seems really high to me (as a reference point, my build task - LESS & webpack - uses ~100mb of memory). the really weird thing is that v4 crashes but v0.10 does not yet my understanding is that both use the same default memory limit. ¯_(ツ)_/¯ |
@dignifiedquire thanks for taking a look.
yep, it doesn't work (same for setting it via config.client.args)
i poked at that approach a bit but it seemed like a dead-end - in part b/c of this. |
A lot of things have changed in the v8 versions between 0.10 and 4.0 so it might be that sth there is the result of the crashing in one point and working fine in the other. From the file count these limits should never be reached (I've run karma on larger projects, e.g. take a look at the angular main source) so it seems to be that there is probably some memory leak/bug why this is happening :/ |
Could you try reducing the amount of files/tests you are loading and see if there is a limit/specific file that triggers this? |
@dignifiedquire yep, can do. buried in my note above --> i can run ~800 files tests across 87 files before hitting the limit and crashing. that was just a quick try though. i'll be more deliberate and see what i see :) |
What's the target file count? (test files and source files being loaded) |
@dignifiedquire just looking at chrome's network tab while running in the debug view, i see 232 files / 458mb(!). this includes helpers like chai.js, mocha.js, etc but is mostly local source. (NOTE: this is while running to completion w/ it's not uncommon to see individual test files > 4mb since these are built by webpack and include external dependencies (e.g. react, etc) as well as sourcemaps. that certainly seems like something i can tune a bit better - maybe by loading common deps in a single file or something. edit: like this (>_<) |
@dignifiedquire do you need any additional info? I faced the same issue |
This issue is also coming up with me. I can confirm that karma is using ~1600Mb of virtual memory and ~600Mb of actual memory. Some notes about my config:
I attempted to take some heap snapshots of karma using node-inspector, and noticed that when I would attempt to snapshot the heap for when I was testing my React components, i would trigger the Does anyone have any pointers about further debugging this issue? |
@ianks what I did is, maybe it can be helpful
|
@ianks just wondering if this is related to karma-sourcemap-loader plugin? same setup except it's angular 2 project with TS |
We are facing the same issue with https://github.com/ipfs/js-ipfs-api, both in Node.js v4 and Node.js v6. @dignifiedquire do you recommend any solution? Running it on a child_process? Adding a option to karma to enable using more memory for the proc? |
After some investigation, this seems to be related with webpack, some issues for reference that could influence this
|
It might be that we just need to give it more memory on larger projects though, like suggested in webpack/webpack#1875 |
When using > node --max_old_space_size=4096 node_modules/.bin/gulp task |
@dignifiedquire the thing is we're using babel-node and there wasn't any way to increase space size. |
doesn't work for me as well. still have crashes |
Thanks @havenchyk. From your comment above it sounded like the latest version of babel-node does support the flag passing though? |
yep, it works (node takes 4GB of my memory), but I don't like this solution, it's a workaround. I believe that the problem is in webpack itself, but didn't find any quick or even not a quick fix. So for you as for karma maintainer, I'd say it's not a problem of karma itself and issue can be closed. I have the same error (rarely) with webpack in dev mode |
I had the same problem and I used the The problem with this approach is that you can't include test dynamically (just test one spec for instance).
|
If others are having this issue still, I solved it buy using
instead of
Make sure karma is included in your project's node_modules. |
another workaround is:
const testsContext = require.context('./src', true, /\.spec\.js$/);
testsContext.keys().forEach(testsContext);
files: [
'loadtests.js',
],
preprocessors: {
'loadtests.js': ['webpack', 'coverage'],
}, |
@stevemao thanks, facing the same issue, in webpack use this workaround to fix that |
Got same error. After trying a lot of methods for me helped this one (npm script in package.json):
Also waiting for new TS-loader, see details here: TypeStrong/ts-loader#502 (comment) |
@chennas your problem doesn't seem to related to this issue. More like different versions of node. |
@stevemao Thanks for your quick reply. If I remove the "max size setting" karma is running, but with heap memory issues? Any thoughts are welcomed. Thanks My node version is v8.3.0 |
I 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: { Good luck out there! |
@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). |
Happened to me too, and found out that caused by webpack's |
So is this going to be addressed? |
Based on all of the information posted here, the issue is not something karma-runner can fix. The runner itself is not causing memory overflow but some combination of webpack and sourcemaps. It looks like @stevemao has a workaround. |
to avoid the above comments confuse people in the future At least for me. |
Although the test are passing, the process crash with error Assertion failed: (0), function uv_close, file ../deps/uv/src/unix/core.c, line 187. Abort trap: 6 the problem is somewhere between karma and webpack most hopeful lead I follow is from the is issue: karma-runner/karma#1868 not very successful so far, but this change doesn't hurt.
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 base. Previously, webpack configuration provided to Karma contained `devtool = sourcemap` and might caused growing memory usage along with increased codebase. To mitigate this problem as a quick fix during stabilization period, following non-production changes were made: - Changed source maps generation for karma tests to use lightweight 'eval' option - `Sourcemap` preprocessors are removed While testing locally, I couldn't get OOM exception with following configs. Related issue in Karma repo: karma-runner/karma#1868 (comment) Release justification: Non-production code change Release note: None
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. Now this OOM exception more likely is caused by increasing code base. Previously, webpack configuration provided to Karma contained `devtool = sourcemap` and might caused growing memory usage along with increased codebase. To mitigate this problem as a quick fix during stabilization period, following non-production changes were made: - Changed source maps generation for karma tests to use lightweight 'eval' option - `Sourcemap` preprocessors are removed While testing locally, I couldn't get OOM exception with following configs. Related issue in Karma repo: karma-runner/karma#1868 (comment) Release justification: Non-production code change Release note: None 46132: sql: trace execution stats for query diagnostics r=RaduBerinde a=RaduBerinde The distsql processors are initialized with the Context in the eval context. If this context contains a tracing span that is recording, the processors will set up statistics collection and put them in the span as tags. The statement diagnostics code sets up a span but doesn't change this context, so statistics collection doesn't happen. We want these statistics in the trace, as they will soon be used to generate EXPLAIN ANALYZE diagrams for the bundles. This change fixes this issue and moves up the initialization of the planner so we can tweak it directly, which simplifies code. Release note (bug fix): statement diagnostics traces now contain processor statistics. Release justification: Bug fixes and low-risk updates to new functionality 46179: sql: decrease job adopt interval for more schema change tests r=lucy-zhang a=ajwerner This commit is a follow up to #45992. It adds some tests that were missed and refactors the setup to a helper. Fixes #45970. ``` --- PASS: TestPrimaryKeyChangeWithPrecedingIndexCreation (1.04s) --- PASS: TestCRUDWhileColumnBackfill (0.73s) --- PASS: TestIndexBackfillAfterGC (0.74s) --- PASS: TestSchemaChangeGRPCError (0.67s) --- PASS: TestFKReferencesAddedOnlyOnceOnRetry (0.50s) ``` Release justification: non-production code changes Release note: None Co-authored-by: Andrii Vorobiov <[email protected]> Co-authored-by: Radu Berinde <[email protected]> Co-authored-by: Andrew Werner <[email protected]>
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 during builds by karma. Actually the problem was in webpack and the way it preprocess files by karma `preprocessors: [...]`. Before we provided a bunch of files (source and test files) and webpack processed each matched file separately what caused memory consumption overhead. Current solution: - removes source files from karma configuration entirely. Required sources are already imported in test files so they will be included as well. - added `tests-loader` file as a single entry point for all test files. It allows us to provide and preprocess one file with all required test file at once. Current fix is based on found work around: karma-runner/karma#1868 (comment) Release note: None Release justification: non-production code changes
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 the root cause of issue is source maps generated during builds by karma. Actually the problem was in webpack and the way it preprocess files by karma `preprocessors: [...]`. Before we provided a bunch of files (source and test files) and webpack processed each matched file separately what caused memory consumption overhead. Current solution: - removes source files from karma configuration entirely. Required sources are already imported in test files so they will be included as well. - added `tests-loader` file as a single entry point for all test files. It allows us to provide and preprocess one file with all required test file at once. Current fix is based on found work around: karma-runner/karma#1868 (comment) Release note: None Release justification: non-production code changes Co-authored-by: Andrii Vorobiov <[email protected]>
hey there -
i'm hitting the following error after upgrading to node v4 LTS.
Likewise, i see a similar error when running tests in chrome:
My environment:
I tried updating to the latest phantomjs but the error persisted - upgrades:
Running under the old configuration works fine:
I'm on os-x v10.10.5
The text was updated successfully, but these errors were encountered: