FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed
I useed Linux native with npm 10.8.3 node 22.8.0. And also, Docker with node:18-alpine and node:20-alpine and I have > 14GB RAM free. I always get the same error, any hints how to processed?:
$ sudo npm install -g @commerce-apps/[email protected]; node --trace-deprecation /usr/local/bin/raml-toolkit diff --log-level=debug /tmp/old.raml /tmp/new.raml -f console
npm warn deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated @oclif/[email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm warn deprecated @oclif/[email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm warn deprecated @oclif/[email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm warn deprecated @oclif/[email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm warn deprecated @oclif/[email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm warn deprecated @oclif/[email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated @oclif/[email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm warn deprecated @oclif/[email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm warn deprecated @oclif/[email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm warn deprecated @oclif/[email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm warn deprecated [email protected]: Sparqlee has been moved to @comunica/expression-evaluator
changed 478 packages in 8s
30 packages are looking for funding
run `npm fund` for details
(node:14358) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
at node:punycode:3:9
at BuiltinModule.compileForInternalLoader (node:internal/bootstrap/realm:399:7)
at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:338:10)
at loadBuiltinModule (node:internal/modules/helpers:108:7)
at Module._load (node:internal/modules/cjs/loader:1099:17)
at TracingChannel.traceSync (node:diagnostics_channel:315:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
at Module.require (node:internal/modules/cjs/loader:1339:12)
at require (node:internal/modules/helpers:135:16)
at Object.<anonymous> (/usr/local/lib/node_modules/@commerce-apps/raml-toolkit/node_modules/whatwg-url/lib/url-state-machine.js:2:18)
Finding differences between flattened JSON-LD of /tmp/old.raml and /tmp/new.raml
Added plugin to include node ID in the node delta: addNodeInfo,collectChildren,trivial,dates,texts,objects,arrays
<--- Last few GCs --->
[14358:0x35958000] 19360 ms: Mark-Compact 2002.3 (2095.4) -> 2000.4 (2095.7) MB, pooled: 1 MB, 246.40 / 0.00 ms (average mu = 0.075, current mu = 0.005) allocation failure; scavenge might not succeed
[14358:0x35958000] 19597 ms: Mark-Compact 2001.0 (2095.9) -> 2000.6 (2095.4) MB, pooled: 2 MB, 237.03 / 0.00 ms (average mu = 0.039, current mu = 0.001) allocation failure; scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----
1: 0xe35ec2 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [node]
2: 0x124f9c0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
3: 0x124fc97 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
4: 0x147f4d5 [node]
5: 0x147f503 [node]
6: 0x14985ba [node]
7: 0x149b788 [node]
8: 0x1e340b1 [node]
Hey @newsgrep, thanks for creating this issue. Does this issue happen outside a docker environment? When you say you have 14 GB of RAM free, does that mean for your machine or the memory you've allocated for your docker container? I'm not sure what the issue is but here's a few things you can try:
- clear cache:
npm cache clean --force - use a different version of node
- Increase maximum memory for docker with the
--memoryflag - Increase memory for node with the
--max-old-space-sizeflag: https://nodejs.org/api/cli.html#--max-old-space-sizesize-in-megabytes
Let me know if this doesn't resolve the issue, I can create a ticket in our backlog for this work.
Thank you for your response.
- Did not help
- Used 20 and 22 which Version shall I try?
- I mean the RAM on my machine; it also happened when I run node natively without Docker.
- Did not help
Currently our CI tests against node versions 10, 12, 14, and 16 as this package does not usually receive any updates as of recently, but unsure how likely this is to solve your issue.
I'll file a bug on our backlog to resolve this issue for now, but I have been unable to reproduce your issue
same with "npm":"8.19.4","node":"v16.20.2"
I tried my luck again with the new raml-toolkit verison and I got it working now with @commerce-apps/raml-toolkit/0.8.0 linux-x64 node-v24.9.0 and
node --max-old-space-size=4096 /usr/local/bin/raml-toolkit diff old.raml new.raml (did not check on older Node versions)
Thank you for the hint with --max-old-space-size= and updating the raml-toolkit.
Would be nice to see farther performance / cache optimizations, but it works for now.
Edit: I also noticed that diff old.raml new.raml works with --max-old-space-size=2048 but diff new.raml old.raml needs more heap...