Support Forums

Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Netlify site: davidrhoden-basic.netlify.app or davidrhoden.com

This is an #eleventy site, still no tag available for that.

Build is failing repeatedly. I have tried adding the environment variables NODE_VERSION: 14 and NODE_VERSION: 15 (as described in this post: Continuous Deployment with Git). That did not work.

I’m also getting the useless error message 9:56:33 AM: Build failed due to a user error: Build script returned non-zero exit code: 2 and the possibly useful error message 9:56:30 AM: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Here’s more:

9:38:54 AM:   "build.command" failed                                        
9:38:54 AM: ────────────────────────────────────────────────────────────────
9:38:54 AM: ​
9:38:54 AM:   Error message
9:38:54 AM:   Command was killed with SIGABRT (Aborted): eleventy
9:38:54 AM: ​
9:38:54 AM:   Error location
9:38:54 AM:   In build.command from netlify.toml:
9:38:54 AM:   eleventy
9:38:54 AM: ​
9:38:54 AM:   Resolved config
9:38:54 AM:   build:
9:38:54 AM:     command: eleventy
9:38:54 AM:     commandOrigin: config
9:38:54 AM:     environment:
9:38:54 AM:       - NETLIFY_LFS_ORIGIN_URL
9:38:54 AM:       - NODE_VERSION
9:38:54 AM:     publish: /opt/build/repo/_site
9:38:54 AM:     publishOrigin: config```

If it makes any difference, my branch deploy, https://text-timeline--davidrhoden-basic.netlify.app/ works fine. It was when I merged this branch into master that the problem started.

hi there, can you give this is a read through and see if it fixes your problem?

1 Like

Thanks, perry. I read it. I installed Docker, pulled the xenial build, and cloned the build-image repo. Then I tried to run the debug build. I got this error:

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

Not sure if that tells me anything. I’m on an M1 MacMini. Do I need to request a specific platform? (First time using Docker.)

hmm, that question goes beyond what i can answer at this time - but i will try and get someone else on the case for you.

1 Like

Thanks. Now my branch deploys are also failing, with the same or similar error. I am running locally on node 16 and have updated the environment variable to reflect that.

I got my branch deploys working again. There was a file of javascript code that was basically notes–I deleted that from my branch and the builds started working again. This file doesn’t exist in my master branch though.

More details from the deploy logs, if anyone is looking:

3:34:00 PM: [1328:0x421ef30]    96930 ms: Scavenge 1389.0 (1424.1) -> 1388.1 (1424.6) MB, 56.2 / 0.0 ms  (average mu = 0.217, current mu = 0.189) allocation failure
3:34:00 PM: [1328:0x421ef30]    96942 ms: Scavenge 1389.1 (1424.6) -> 1388.2 (1425.1) MB, 6.7 / 0.0 ms  (average mu = 0.217, current mu = 0.189) allocation failure
3:34:00 PM: <--- JS stacktrace --->
3:34:00 PM: ==== JS stack trace =========================================
3:34:00 PM:     0: ExitFrame [pc: 0xea44df5bf1d]
3:34:00 PM: Security context: 0x05c85e31e6c1 <JSObject>
3:34:00 PM:     1: /* anonymous */ [0xf41e73f9d61] [/opt/build/repo/node_modules/@11ty/eleventy/src/Filters/Slug.js:~3] [pc=0xea44e2a92ed](this=0x1aa0ea745c29 <Context map = 0xc7a3e4ac891>,str=0x263580f519e1 <String[11]: Chattanooga>)
3:34:00 PM:     2: /* anonymous */ [0x2950b17f3749] [/opt/build/repo/node_modules/@11ty/eleventy/src/BenchmarkGroup.js:~28] [pc=0xea44e2888a3](this=0x...
3:34:00 PM: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
3:34:00 PM:  1: 0x8fb090 node::Abort() [node]
3:34:00 PM:  2: 0x8fb0dc  [node]
3:34:00 PM:  3: 0xb0336e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
3:34:00 PM:  4: 0xb035a4 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
3:34:00 PM:  5: 0xef7602  [node]
3:34:00 PM:  6: 0xef7708 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [node]
3:34:00 PM:  7: 0xf037e2 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node]
3:34:00 PM:  8: 0xf04114 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
3:34:00 PM:  9: 0xf06d81 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [node]
3:34:00 PM: 10: 0xed0204 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [node]
3:34:00 PM: 11: 0x11702de v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [node]
3:34:00 PM: 12: 0xea44df5bf1d
3:34:00 PM: ​
3:34:00 PM: ────────────────────────────────────────────────────────────────
3:34:00 PM:   "build.command" failed                                        
3:34:00 PM: ────────────────────────────────────────────────────────────────
3:34:00 PM: ​
3:34:00 PM:   Error message
3:34:00 PM:   Command was killed with SIGABRT (Aborted): eleventy

Is there a maximum number of pages an eleventy site can have on Netlify? I’ve got a little over a thousand.

I’m going to go ahead and split-test my site to use the working branch most of the time (98%/2%) and move changes gradually from master to that branch until I can diagnose the problem. IT’s been two days since my master branch deployed.

The problem basically says that your app is somehow needed more resources than Netlify’s build image can provide. This should not be the case - it might mean there’s some kind of optimisation lacking in the build process. Number of pages is not a problem - people have over 20 or 30k pages too.

You can try running Node with --max-old-space-size=8192 flag to see if it changes anything.

1 Like

Thanks, hrishikesh. Adding


to my netlify.toml did allow the site to build (though this first build was noticeably slow (7min, 37sec).

I’d love to know if there is any way to tell what’s making it slow. The main change I made before this build was to add a collection called bySize that sorts my blog tags by how many times they are used. I wouldn’t think adding a collection would slow the site build, but maybe it could?

Anyway, thanks, marking this solved for now.

I think the first build generally takes time as it has to clone your repo, install dependencies, and setup cache. Are you having slower builds subsequently too?