Compiling ivy with aot leads to "ERROR in Maximum call stack size exceeded"
See original GitHub issue🐞 Bug report
Command (mark with an x
)
- new
- build
- serve
- test
- e2e
- generate
- add
- update
- lint
- xi18n
- run
- config
- help
- version
- doc
Is this a regression?
Yes and no. Version 8 and 9 without ivy work just fine. However ivy has problems with aot.
Description
After updating existing Angular project from version 8 to 9, compilation with ivy and aot leads to “ERROR in Maximum call stack size exceeded”. Non-ivy compilation works fine with or without aot with all optimization options. Also ivy WITHOUT aot works fine regardless of optimization options.
After much work I have isolated the problem to a module containing a highly mutually interdependent classes. More specifically if any class is imported from that module aot compilation crashes.
🔬 Minimal Reproduction
I have separated the troublesome module from the larger project and created a minimal test bench and can share it via github private repo on request.
🔥 Exception or Error
ERROR in Maximum call stack size exceeded
🌍 Your Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 9.1.0
Node: 12.16.1
OS: win32 x64
Angular: 9.1.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.901.0
@angular-devkit/build-angular 0.901.0
@angular-devkit/build-optimizer 0.901.0
@angular-devkit/build-webpack 0.901.0
@angular-devkit/core 9.1.0
@angular-devkit/schematics 9.1.0
@ngtools/webpack 9.1.0
@schematics/angular 9.1.0
@schematics/update 0.901.0
rxjs 6.5.5
typescript 3.8.3
webpack 4.42.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
"Maximum call stack size exceeded" in Angular 9 ng build
I had circular dependencies caused by my IDE automatically adding references to modules and components before I changed some things around. Use ...
Read more >Angular Aot Build Error Maximum Call Stack Size Exceeded ...
This error is almost always means you have a problem with recursion in JavaScript code as there isn't any other way in JavaScript...
Read more >maximum call stack size exceeded angular - You.com
1.This error occur when there is an infinite loop. As you have mentioned that the page loads when app-heroes is commented, this might...
Read more >angular/angular-cli - Gitter
Hello Iam gettingE RROR in Maximum call stack size exceeded. @angular/cli: 1.0.0-beta.31 node: 7.4.0 os: win32 x64. I saw a few hints about...
Read more >Angular Ivy
If you opt-out of bundling dependencies you will need to run the standalone Angular compatibility compiler ( ngcc ). This is needed because...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@SPKorhonen - the problem is in your code. The Angular compiler is trying to statically analyse the code and it gets to this method:
which is infinitely recursive. And so the static analyzer is unable to stop - leading to a call stack overflow.
Thanks for very fast reply.
Unfortunately the nightly did not resolve the problem.
I have send invitations for the aot-crash repo.
FYI: the problematic module is aot-crash/src/app/spin/spinsystem.ts which is used within aot-crash/src/app/crash.service.ts