We have recently migrated our .NET 5 application to .NET 7 and also upgraded our UI framework from standard MVC to Vue 3. We are fully up and running with our code deployed. Just about a week after deployment we started noticing random, seemingly unrelated, System.OutOfMemoryException
s.
Now I apologize, I am not familiar with this type of exception/error and will do my best to provide relevant information.
These exceptions are being thrown at different, unrelated parts of the code base that do not necessary always deal with large pieces of data (strings, collections, or arrays, etc.). Other than our main startup method (which even then didn't have huge differences), none of the code has changed with this migration to .NET 7 where these exceptions are being thrown. So it is strange to us that while running on .NET 5 the same piece of code has no issues and while running on .NET 7 we consistently get System.OutOfMemory
exceptions.
We run 32x .NET on a 64x machine. This is no different than when we were running the .NET 5 application. So I'm not sure running 32x .NET would be the issue. Moving to 64x is not really an option right now, the cons of the move are just deal breakers for us (I think).
The way we are using/handling data such as string/arrays/collections of the sort has not changed from when we were on the .NET 5 application
I have explored this issue and tried setting the env variable COMPlus_GCRegionRange
to 10700000000 on my local machine. This did not resolve the issue.
I have looked for a way to turn off the new "GC Regions" in .NET 7, and have not found anything. I'm unsure if this is ultimately the cause of the problem.
I am not familiar with how to properly debug/triage this issue. I've read through a lot of Microsoft docs and articles on this issue, and it's still pretty unclear as the best way to go about troubleshooting it.
I'm sure there could be a plethora of possible issues/solutions. But I'm hoping someone can at least point me in the right direction for solving this.
** Edit: If there is anything I could provide to assist in having someone else assist me, please let me know. Our code base and data contains sensitive information so I will do my best to provide meaningful results or examples where I can. I just do not know what to provide to make this process easier.
We ended up moving the .net application to 64 bit which resolved our OutOfMemory exceptions.