Skip to content
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

Out of memory error after upgrade from v13 to v14 #23402

Closed
3 of 15 tasks
MarcoGlauser opened this issue Jun 20, 2022 · 3 comments
Closed
3 of 15 tasks

Out of memory error after upgrade from v13 to v14 #23402

MarcoGlauser opened this issue Jun 20, 2022 · 3 comments

Comments

@MarcoGlauser
Copy link

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

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

Description

After the upgrade from v13 to v14, builds fail with OOM errors. Adding --max_old_space_size=4096 works for one off builds but ng serve or ng test crash after a couple iterations.

🔬 Minimal Reproduction

I don't exactly know how to create a minimal reproduction, any pointers on how to debug this memory leak are appreciated :)

I've run the "Allocation sampling" memory profiling for our angular 13 and 14 application:
angular-heap-13-vs-14.zip

🔥 Exception or Error


> ng test

⠙ Generating browser application bundles (phase: setup)...Processing legacy "View Engine" libraries:
- ngx-quicklink [es2015/esm2015] (git+https://github.com/mgechev/ngx-quicklink.git)
Encourage the library authors to publish an Ivy distribution.

<--- Last few GCs --->

[68525:0x4db96f0]    94015 ms: Scavenge 4042.9 (4124.7) -> 4038.3 (4126.7) MB, 9.1 / 0.0 ms  (average mu = 0.912, current mu = 0.664) allocation failure 
[68525:0x4db96f0]    94086 ms: Scavenge 4044.6 (4126.7) -> 4039.8 (4127.7) MB, 8.6 / 0.0 ms  (average mu = 0.912, current mu = 0.664) allocation failure 
[68525:0x4db96f0]    94153 ms: Scavenge 4045.9 (4127.7) -> 4041.3 (4144.7) MB, 11.1 / 0.0 ms  (average mu = 0.912, current mu = 0.664) allocation failure 


<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 0xb09c10 node::Abort() [ng test]
 2: 0xa1c193 node::FatalError(char const*, char const*) [ng test]
 3: 0xcf8dde v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [ng test]
 4: 0xcf9157 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [ng test]
 5: 0xeb09f5  [ng test]
 6: 0xec06bd v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [ng test]
 7: 0xec33be v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [ng test]
 8: 0xe84632 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [ng test]
 9: 0xe7ef4c v8::internal::FactoryBase::AllocateRawArray(int, v8::internal::AllocationType) [ng test]
10: 0xe7f025 v8::internal::FactoryBase::NewFixedArrayWithFiller(v8::internal::Handle, int, v8::internal::Handle, v8::internal::AllocationType) [ng test]
11: 0x10e78ae v8::internal::MaybeHandle v8::internal::OrderedHashTable::Allocate(v8::internal::Isolate*, int, v8::internal::AllocationType) [ng test]
12: 0x10e7963 v8::internal::MaybeHandle v8::internal::OrderedHashTable::Rehash(v8::internal::Isolate*, v8::internal::Handle, int) [ng test]
13: 0x11f3a75 v8::internal::Runtime_MapGrow(int, unsigned long*, v8::internal::Isolate*) [ng test]
14: 0x15f20b9  [ng test]
Aborted (core dumped)

🌍 Your Environment


Angular CLI: 14.0.2
Node: 16.15.1
Package Manager: npm 8.6.0 
OS: linux x64
@alan-agius4
Copy link
Collaborator

alan-agius4 commented Jun 20, 2022

Hi @MarcoGlauser,

Thanks for reporting this and sharing the memory profiles.

I had a look at them and it appears that TypeScript is consuming more memory in your case. There is already an open issue in the TypeScript repo microsoft/TypeScript#39059

As an interim workaround you could try to downgrade TypeScript to 4.6.x.

@MarcoGlauser
Copy link
Author

MarcoGlauser commented Jun 21, 2022

Thank you for the pointers :)

I tested some typescript and angular combinations and it seems that typescript 4.6.1-rc is indeed the last version that works.
Since Angular 14 requires at least 4.6.2, we'll have to wait until Typescript fixes the underlying issue.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jul 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants