-
Notifications
You must be signed in to change notification settings - Fork 12k
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
serve crashes randomly after upgrading to Angular 12 #20801
Comments
Hi @glued, Can you kindly share your project (even privately) or heap snapshots?, Unfortunately, without any addition information we will not be able to look into this issue. |
Couple of questions to can further help us.
|
@alan-agius4, thanks for the direction. But I do really feel the build time issue relates to this one and vice versa. Here is the error
|
Also I just tried to compare the memory size allocated for v11 and for v12 v11 gets ~600 Mb of memory and doesn't get increased on each rebuild. v12 starts with almost 1.5 Gb and increases each time rebuild happens. I guess when the memory allocation hits some limit the error occurs. |
Can you try to use |
v12 versioning:
v11 versioning:
|
Tried that. |
@anton-white yes I can attest to that, same happened to me, compiler is randomly exceeding the memory usage than default max of NodeJs. My temp fix was to increase the max memory for node. But still it is taking a long time for compilation. @alan-agius4 it is same situation when named chunk is true or false in the config. Memory usage is around 4-5GB. |
@anton-white are you using angular material theming? for me compile time issue was because of the following lines
ng update added the @use but kept second line. After removing that (angular/components#22676 (comment)) compile time has improved by a lot. memory usage is still high. |
@sha-N |
Are you using HMR?
Are you using named chunks?
|
I spent some times looking into a project that does show OOM issues during rebuilds. The project in question was provided by @ganySA privately. (Thanks a lot for this). What I found out from my investigation on the mentioned project is;
To sum it up, from the project I look at, it doesn't appear that there is a memory leak as memory usage stays within the same range over a number of rebuilds but rather the increase in memory usage is to be attributed to Webpack 5 caching. Note: there are number of options such as That said, without a reproduction even shared privately or memory snapshots, we will not be able to determine if there is a memory leak, or it's just the expected increase of memory usage due to Webpack 5 caching, in the upcoming release we also shifted SASS to be processed in workers which should help reduce memory pressure on the main thread since workers have a dedicated memory pool. |
while upgrading from angular 11 to 12, the in the angular .json file, the aot flag updated to false, with this value ng serve is working perfectly but while running ng test command its thworing the "Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory". If only one test file is run , then it succeeds -> any help to fix this up? |
@alan-agius4 How can produce a memory snapshot of |
The workaround I have found is run ng serve in this way:
otherwise node crash |
Repeat the last 2 until the OOM error is shown, once done, save the last couple of snapshots and send them over. |
I tried installing 64bit node and it worked fine and resolved my issue. |
@alan-agius4 I have send the memory snapshots at your e-mail |
In my case disabling styles optimizations in One important thing that i've noticed is that the build start crashing after upgrading from project clarity 4 -> 5, i'm assuming that the build is crashing because of some bug on css processing libraries with "modern css" |
Why would you have optimizations enabled during |
Sorry my english is bad.. I get the same error, but i forgot to mention that the error happens only in ng build --configuration production i've disabled those optimizations in the "production" config |
Yesterday release (12.0.1) contains several performance improvements. Please give it a try! |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
哈哈,这样子呀,那就不晓得,我开始12.1.3不行,最后等到1.4可以了。发自我的华为手机-------- 原始邮件 --------发件人: Juan Martin ***@***.***>日期: 2021年8月12日周四 凌晨2:09收件人: angular/angular-cli ***@***.***>抄送: keyanan-x ***@***.***>, Comment ***@***.***>主 题: Re: [angular/angular-cli] serve crashes randomly after upgrading to Angular 12 (#20801)
I keep getting errors about this:
^12.1.4 版本没问题了,可以了。打包速度很快。
I'm on Angular 12.2.0 and it keeps happening all the time.
—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android.
|
Updated to 12.2.0, it seems better now. |
CLI on
|
@weilinzung, please provide memory snapshots otherwise we cannot investigate this issue. |
@weilinzung From the version output, the project appears to contain packages with a mixture of Angular versions (including two different majors): 12.1.2, 12.1.4, 12.2.0, 12.1.5, 11.0.1. |
@alan-agius4 I've been running into this issue as well. I've attached some memory snapshots. At the point where the process ran out of memory it was using 4GB of memory. Angular CLI: 12.2.2 Angular: 12.2.2 Package Version@angular-devkit/architect 0.1201.4 |
I'm getting this issue to the point I can't develop the application anymore, it keeps crashing every 10 mins. Initial build is 1.6GB, and subsequence build increase it by hundred MB Steps to reproduce is pretty easy: ng serve, and then open an editor and keep pressing save repeatedly without any changes However I just got this recently so I will try to track down the cause |
I think for me the issue was with Angular CLI: 12.2.9 Angular: 12.2.9 Package Version@angular-devkit/architect 0.1200.5 https://drive.google.com/file/d/1YKEG_e4gqC6q7jFVKKb0uY6R6O4smL9b/view?usp=sharing |
FYI for us, removing an heavy css import fixed the problem. We were including a ~1MB+ stylesheet in one of our .scss file... which started to trigger this issue after upgrading to Angular 12. |
From #22020 Thx for pointing me to #20801. I've spent the last week studying that and was unable to figure out how to get a heap snapshot when triggering a build (serve) from VS Code. However, I have come up with a workaround/hack(?) that seems to solve my problem. If I issue the following in a newly opened PowerShell console in VS Code I am able to avoid the heap OOM on my rebuilds (re-serves): It looks like VS Code ignores a globally set environment variable so I have to set it in the same process where the build occurs. That' interesting because "dir env:" shows that all of the other global environment variables have been inherited - just not NODE_OPTIONS. I have no idea if I just needed some additional memory or if there is still a bug but I just haven't done enough rebuilds(re-serves) to trigger it again. Any ideas/comments? Thx, |
I have just updated to nx 13.1.3 and Angular 12.x.x and my server build crashes! I do usually run the server with the command Additional info: Due to upgrading problems I removed node_modules and package_lock prior install. Thus it is a pretty clean repository now. 19.11.2021: Updated to nx v |
Getting this error with Angular v13.2, was on v11+ and no issue before |
I upgraded to Angular |
Upgraded from I can reproduce this issue every time when I use a second terminal to run |
Sadly this is not an issue with Angular, but with Webpack: webpack/webpack#12771 I used to crash after every change, but after minifying (any simplifying) JSON files from 500Mb to 50Mb, the crashes are gone. So my suggestion is to look for large imported files and try not to import them if possible. |
I don't have large files in angular. It just consumes up to 2.9 gb and during build, it'd go up to 3.5 gb. I have zero idea why whould serve take that much space. The project is huge and this was pain but nothing is clear about whys here. I had to ditch Ng serve completely and use Ng build with nodemon and angular 13. Since angular 13 caches build. This helped as a workaround with a great difference. Now angular consumes 50mb runtime and 1 gb during build. I still wonder why build would go that much high. It's just frontend. Nestjs (backend) does tons better job than angular in this. |
Also since ditching Ng serve. It's much more stable for me. No more weird unexplained port drops or simply the serve stops for unknown reason. It's just stable for me |
@SDAdham @Akxe I had this issue in early v12 versions, but it's been working fine in both |
@pmoleri , I've got everything you mentioned in there, except sadly only |
Any update on this? 👀 |
Unfortunately without a reproduction this isn't really actionable. |
@JoostK Build an app with 100Mb JSON file, it will do the job, at least does for me. I know that because removing these from the build did remove the error. |
@Akxe can you prepare a repo? |
@JoostK Not anymore actually, sorry |
The issue has been open for some time and a lot has changed since then. While there were several people reporting and commenting on this issue. A reproduction was not provided that demonstrates / suggests that there is a memory leak. If you are still experiencing this issue please open a new issue and provide all necessary information including a minimal reproduction or at the very minimum memory snapshots. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🐞 Bug report
Command (mark with an
x
)Is this a regression?
yes, did not see this issue in Angular 10 or 11
Description
While running
A clear and concise description of the problem...ng serve
for a few hours it will randomly crash with an error. When I upgraded to angular 12, I also upgraded to node 14.17.0🔬 Minimal Reproduction
see above
🔥 Exception or Error
🌍 Your Environment
Anything else relevant?
The text was updated successfully, but these errors were encountered: