Skip to content

JavaScript heap out of memory on ng update @angular/core @angular/cli #18109

@bjornharvold

Description

@bjornharvold

🐞 Bug report

Command (mark with an x)

  • update

Is this a regression?

No

Description

Running an update from Angular 9 -> 10 causes a Javascript heap out of memory error on a large project

🔬 Minimal Reproduction

ng update --force @angular/core @angular/cli

OR

node --max_old_space_size=16384 ./node_modules/@angular/cli/bin/ng update --force @angular/core @angular/cli

🔥 Exception or Error


❯ Add "Solution Style" TypeScript configuration file support.
  This improves developer experience using editors powered by TypeScript’s language server.
  Read more about this here: https://v10.angular.io/guide/migration-solution-style-tsconfig

<--- Last few GCs --->

[10529:0x110008000]    59790 ms: Scavenge 2042.8 (2048.9) -> 2042.4 (2049.1) MB, 3.9 / 0.0 ms  (average mu = 0.095, current mu = 0.066) allocation failure 
[10529:0x110008000]    59866 ms: Scavenge 2043.0 (2049.1) -> 2042.6 (2049.4) MB, 4.6 / 0.0 ms  (average mu = 0.095, current mu = 0.066) allocation failure 
[10529:0x110008000]    59947 ms: Scavenge 2043.3 (2049.4) -> 2042.9 (2049.9) MB, 3.7 / 0.0 ms  (average mu = 0.095, current mu = 0.066) allocation failure 


<--- JS stacktrace --->

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

    0: ExitFrame [pc: 0x100749bf9]
Security context: 0x0922cacc08d1 
    1: _readString(aka _readString) [0x922ca3c3891] [/Users/crash/git/traveliko/traveliko-spa/node_modules/@angular-devkit/core/src/json/parser.js:~236] [pc=0x3f374278ab6a](this=0x0922e76804b1 ,0x0922417349a9 ,0x0922d7272059 )
    2: _readValue(aka _readValue) [0x922ca3c3b11] [/Users/crash/git/traveliko/traveli...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x100ba10bb node::Abort() (.cold.1) [/usr/local/opt/node@12/bin/node]
 2: 0x100080f45 node::FatalError(char const*, char const*) [/usr/local/opt/node@12/bin/node]
 3: 0x1000810ae node::OnFatalError(char const*, char const*) [/usr/local/opt/node@12/bin/node]
 4: 0x100186bed v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/opt/node@12/bin/node]
 5: 0x100186b97 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/opt/node@12/bin/node]
 6: 0x10029e1c9 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/opt/node@12/bin/node]
 7: 0x10029f54e v8::internal::Heap::MarkCompactPrologue() [/usr/local/opt/node@12/bin/node]
 8: 0x10029d11b v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/opt/node@12/bin/node]
 9: 0x10029bbe1 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/opt/node@12/bin/node]
10: 0x10029b06a v8::internal::Heap::HandleGCRequest() [/usr/local/opt/node@12/bin/node]
11: 0x100272c8d v8::internal::StackGuard::HandleInterrupts() [/usr/local/opt/node@12/bin/node]
12: 0x1004d8fbc v8::internal::Runtime_StackGuard(int, unsigned long*, v8::internal::Isolate*) [/usr/local/opt/node@12/bin/node]
13: 0x100749bf9 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/usr/local/opt/node@12/bin/node]
14: 0x3f374278ab6a 
15: 0x3f3742782268 
16: 0x3f37427830ea 
17: 0x3f374278d940 
18: 0x3f3742782354 
19: 0x3f37427830ea 
20: 0x3f374278d940 
21: 0x3f3742782354 
22: 0x3f37427830ea 
23: 0x3f374278d940 
24: 0x3f3742782354 
25: 0x3f37427830ea 
26: 0x1006cf5a4 Builtins_InterpreterEntryTrampoline [/usr/local/opt/node@12/bin/node]

🌍 Your Environment


Angular CLI: 10.0.1
Node: 12.18.1
OS: darwin x64

Angular: 10.0.2
... animations, common, compiler, compiler-cli, core, elements
... forms, language-service, localize, platform-browser
... platform-browser-dynamic, router, service-worker
Ivy Workspace: 

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.901.9
@angular-devkit/build-angular      0.1000.1
@angular-devkit/build-ng-packagr   0.1000.1
@angular-devkit/build-optimizer    0.1000.1
@angular-devkit/build-webpack      0.1000.1
@angular-devkit/core               10.0.1
@angular-devkit/schematics         10.0.1
@angular/cdk                       9.2.4
@angular/cli                       10.0.1
@angular/flex-layout               9.0.0-beta.31
@angular/material                  9.2.4
@ngtools/webpack                   10.0.1
@schematics/angular                10.0.1
@schematics/update                 0.1000.1
ng-packagr                         10.0.0
rxjs                               6.6.0
typescript                         3.9.6
webpack                            4.43.0

Anything else relevant?
I ran ng version after the failed update. Keep in mind the versions here are not the latest because the actual update failed. Had I run it before the update, you would see all Angular 9 versions.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions