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.

Using new NG_PERSISTENT_BUILD_CACHE results in js heap memory error

See original GitHub issue

Bug Report

Affected Package

The issue is caused by package @angular/....

Probably @angular/compiler-cli, @angular/compiler and/or @angular/cli

Is this a regression?

Yes, the previous version in which this bug was not present was: ....

Not present in the same version when not using the flag

Description

A clear and concise description of the problem...

When enabling the NG_PERSISTENT_BUILD_CACHE flag with optimization, aot and buildOptimizer enabled on a large project:

[9613:0xf60cd90]   390146 ms: Mark-sweep 4057.7 (4126.0) -> 4048.0 (4129.2) MB, 2318.9 / 0.1 ms  (average mu = 0.099, current mu = 0.007) allocation failure scavenge might not succeed
[9613:0xf60cd90]   392529 ms: Mark-sweep 4060.6 (4129.2) -> 4050.7 (4132.5) MB, 2365.1 / 0.1 ms  (average mu = 0.055, current mu = 0.008) allocation failure scavenge might not succeed


<--- JS stacktrace --->

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

    0: ExitFrame [pc: 0x1389a0c]
    1: StubFrame [pc: 0x1369280]
Security context: 0xffff941408d1 <JSObject>
    2: split [0xffff9414cd51](this=0xfffe7b9c1d41 <String[54]: /node_modules/node-vibrant/node_modules/lodash/_Set.js>,0xfffe7b9c1da1 <JSRegExp <String[#3]: \/+>>)
    3: /* anonymous */ [0xfffde63be589] [/home/circleci/project/repo/node_modules/@*******-devkit/build-*******/node_modules/webpack/node_modules/source-map/lib/source-...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0xa146c0 node::Abort() [/opt/circleci/.nvm/versions/node/v12.20.2/bin/node]
 2: 0xa14a80 node::OnFatalError(char const*, char const*) [/opt/circleci/.nvm/versions/node/v12.20.2/bin/node]
 3: 0xb7d4f4 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/opt/circleci/.nvm/versions/node/v12.20.2/bin/node]
 4: 0xb7d6f4 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/opt/circleci/.nvm/versions/node/v12.20.2/bin/node]
 5: 0xd284a8 v8::internal::Heap::EnsureFromSpaceIsCommitted() [/opt/circleci/.nvm/versions/node/v12.20.2/bin/node]
 6: 0xd289b0 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/opt/circleci/.nvm/versions/node/v12.20.2/bin/node]
 7: 0xd355c0 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/opt/circleci/.nvm/versions/node/v12.20.2/bin/node]
 8: 0xd36314 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/opt/circleci/.nvm/versions/node/v12.20.2/bin/node]
 9: 0xd38884 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/circleci/.nvm/versions/node/v12.20.2/bin/node]
10: 0xd00e30 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/opt/circleci/.nvm/versions/node/v12.20.2/bin/node]
11: 0x1019e30 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/opt/circleci/.nvm/versions/node/v12.20.2/bin/node]
12: 0x1389a0c  [/opt/circleci/.nvm/versions/node/v12.20.2/bin/node]

This does not happen when building the same project with the same configuration without the flag

Your Environment

Angular Version:


Angular CLI: 12.1.0
Node: 12.22.1
Package Manager: yarn 1.22.10
OS: darwin x64

Angular: 12.1.0
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, material, platform-browser
... platform-browser-dynamic, platform-server, router
... service-worker, youtube-player

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1201.0
@angular-devkit/build-angular   12.1.0
@angular-devkit/core            12.1.0
@angular-devkit/schematics      12.0.2
@angular/fire                   6.1.4
@angular/flex-layout            12.0.0-beta.34
@nguniversal/builders           12.0.1
@nguniversal/common             12.0.1
@nguniversal/express-engine     12.0.1
@schematics/angular             12.1.0
ng-packagr                      12.0.2
rxjs                            6.6.3
typescript                      4.3.4
webpack                         4.46.0

Anything else relevant?

ARM, Ubuntu on CircleCI

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
alan-agius4commented, Jul 1, 2021

Typically this cache is more beneficial in local environments during development.

0reactions
angular-automatic-lock-bot[bot]commented, Aug 12, 2021

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix JavaScript Heap Out of Memory Error - MakeUseOf
This error usually occurs when the default memory allocated by your system to Node. js is not enough to run a large project....
Read more >
JavaScript Heap Out Of Memory Error | Felix Gerschau
This error indicates high memory usage or a memory leak in your application. In this article, I cover different solutions to this problem....
Read more >
How to solve JavaScript heap out of memory error
An example of this error can be found when you have to build the packages you installed using npm install with the node-gyp...
Read more >
Using new NG_PERSISTENT_BUILD_CACHE results in js ...
Not quite sure how to measure the heap usage but I have the max node space size set to 4096 as a flag...
Read more >
Node.js heap out of memory - javascript - Stack Overflow
Today I ran my script for filesystem indexing to refresh RAID files index and after 4h it crashed with following error:
Read more >

github_iconTop Related Medium Post

No results found

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