Open nscarcella opened 4 years ago
We got similar error upgrading TS from 4.5.2
-> 4.5.5
. Had to roll back:
[api] RangeError: Maximum call stack size exceeded
[api] RangeError: Maximum call stack size exceeded
[api] at isRelatedTo (/usr/src/node_modules/typescript/lib/typescript.js:63309:33)
[api] at typeArgumentsRelatedTo (/usr/src/node_modules/typescript/lib/typescript.js:63768:39)
[api] at relateVariances (/usr/src/node_modules/typescript/lib/typescript.js:64444:34)
[api] at structuredTypeRelatedToWorker (/usr/src/node_modules/typescript/lib/typescript.js:64378:46)
[api] at structuredTypeRelatedTo (/usr/src/node_modules/typescript/lib/typescript.js:63920:30)
[api] at recursiveTypeRelatedTo (/usr/src/node_modules/typescript/lib/typescript.js:63887:64)
[api] at isRelatedTo (/usr/src/node_modules/typescript/lib/typescript.js:63403:34)
[api] at isPropertySymbolTypeRelated (/usr/src/node_modules/typescript/lib/typescript.js:64642:24)
[api] at propertyRelatedTo (/usr/src/node_modules/typescript/lib/typescript.js:64675:31)
[api] at propertiesRelatedTo (/usr/src/node_modules/typescript/lib/typescript.js:64876:43)
I'm also getting a "Maximum call stack size exceeded" error on upgrade from 4.6.0-beta to 4.6.1-rc through 4.63. I'm working in a large proprietary codebase which I can't share. I'd love some tips on how to debug tsc to find the types it's choking on.
We're also running into this issue with our Angular project. For us it happened when moving for 4.6.1-rc to 4.6.2. Adding --max_old_space_size=4096 works for one off builds but live reloading crashes after a couple of iterations.
Here are the memory profiles for 4.5.5, 4.6.1-rc, 4.6.2 : ts-4..zip You can see 4.5.5 and 4.6.1-rc behaving the same, but 4.6.2 not releasing memory and crashing instead. Let me know if you need any more information.
here you have @nscarcella ’s code in playground.
Angular CLI: 14.2.0 Node: 16.13.0 Package Manager: npm 7.22.0 OS: win32 x64
Angular: 14.2.0 ... animations, cdk, cli, common, compiler, compiler-cli, core ... forms, language-service, material, platform-browser ... platform-browser-dynamic, router
@angular-devkit/architect 0.1402.0 @angular-devkit/build-angular 14.2.0 @angular-devkit/core 14.2.0 @angular-devkit/schematics 14.2.0 @schematics/angular 14.2.0 rxjs 7.5.6 typescript 4.8.2
<--- Last few GCs --->
[15680:00000133705CBA10] 267585 ms: Scavenge (reduce) 8065.7 (8244.6) -> 8065.2 (8244.6) MB, 14.7 / 0.0 ms (average mu = 0.218, current mu = 0.028) allocation failure [15680:00000133705CBA10] 267598 ms: Scavenge (reduce) 8066.0 (8244.8) -> 8065.4 (8244.8) MB, 12.2 / 0.0 ms (average mu = 0.218, current mu = 0.028) allocation failure
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1: 00007FF7413B013F v8::internal::CodeObjectRegistry::~CodeObjectRegistry+112495 2: 00007FF74133F396 DSA_meth_get_flags+65526 3: 00007FF74134024D node::OnFatalError+301 4: 00007FF741C719EE v8::Isolate::ReportExternalAllocationLimitReached+94 5: 00007FF741C5BECD v8::SharedArrayBuffer::Externalize+781 6: 00007FF741AFF61C v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1468 7: 00007FF741B0C2C9 v8::internal::Heap::PublishPendingAllocations+1129 8: 00007FF741B0929A v8::internal::Heap::PageFlagsAreConsistent+2842 9: 00007FF741AFBF19 v8::internal::Heap::CollectGarbage+2137 10: 00007FF741AFA0D0 v8::internal::Heap::AllocateExternalBackingStore+2000 11: 00007FF741B1EA06 v8::internal::Factory::NewFillerObject+214 12: 00007FF741851CD5 v8::internal::DateCache::Weekday+1797 13: 00007FF741CFF3E1 v8::internal::SetupIsolateDelegate::SetupHeap+494417 14: 00007FF741C942EE v8::internal::SetupIsolateDelegate::SetupHeap+55902 15: 0000013373C899F6
I know this was the issue that was linked from the angular-cli thread, but I feel like the "heap out of memory" issue is probably different from the "maximum call stack size exceeded" mentioned by the OP. We were also seeing the memory leak with Angular 14.1, though tentatively it seems to be behaving better on 14.2.4, maybe related to angular/angular#47508?
After migrating from 3.7.5 to any later version the attached code makes the compiler fails with the following error:
The same file compiles fine in 3.7.5 and I can't find a way to adapt it to the newer versions.
TypeScript Version: any version above 3.7.5
Search Terms: "Maximum call stack size exceeded" "Range Error" "Regression" "3.8"
Config:
Code Sorry about the lengthy code, I removed as much unrelated logic as I could and trimmed all methods and fields from the classes so it will be as short as possible while still triggering the error consistently. Removing any of the seemingly trivial classes left prevents the error (not sure why, though) but it's, of course, not a valid option.
Expected behavior: The code builds successfully.
Actual behavior: The compilation fails.