Multiple 'System.OutOfMemoryException' errors in .NET 7
I'm seeing an issue very similar to this one when running a memory-heavy app on a linux container with memory limit >128GB RAM.
The app started throwing random OutOfMemoryException in many unexpected places since we migrated to net70, while under no memory pressure (usually with more than 30% free memory).
I can see the original issue was closed, but I'm not sure if it was fixed on the final net70 release or if the suggestion to set COMPlus_GCRegionRange=10700000000 is the expected workaround.
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.
Tagging subscribers to this area: @dotnet/gc See info in area-owners.md if you want to be subscribed.
Issue Details
I'm seeing an issue very similar to this one when running a memory-heavy app on a linux container with memory limit >128GB RAM.
The app started throwing random OutOfMemoryException in many unexpected places since we migrated to net70, while under no memory pressure (usually with more than 30% free memory).
I can see the original issue was closed, but I'm not sure if it was fixed on the final net70 release or if the suggestion to set COMPlus_GCRegionRange=10700000000 is the expected workaround.
| Author: | theolivenbaum |
|---|---|
| Assignees: | - |
| Labels: |
|
| Milestone: | - |
Thanks for reporting this issue. This looks like its separate than the original issue -- we are investigating something similar with another customer. Would it be possible to share a dump when the OOM happens?
Unfortunately not as this is running within a customer infrastructure and the dump would most probably contain confidential data. Is there an issue here on GitHub I can subscribe to?
We dont have an issue yet, so will use this to provide updates. Its most likely something which is fixed in main which might need porting to 7: https://github.com/dotnet/runtime/pull/77478
Hi @theolivenbaum, would it be possible for you to try out a private to ensure the fix resolves your issue?
Thanks
That might be hard as it would involve changing how we build our docker images. But fine to wait till this is back ported to 7 - any idea on a timeline for the next service release?
We're also seeing a lot of OOM exceptions since migrating to .NET 7 from .NET 5 (we're now testing .NET 6). In our case, we're running under Windows via Azure App Services. Reported memory usage is low - perhaps lower than what it was under .NET 5. The project in question loads large-ish files in memory.
can you try if setting COMPlus_GCName=clrgc.dll or COMPlus_GCName=libclrgc.so make the OOMs go away? We are working on a fix, but hoping this could be a temporary workaround. Thx.
We'll try to find time to test this.
@mangod9 We're seeing a similar issue with .NET7 on Ubuntu loading larger files (10+ MB) with File.ReadAllBytes. This works fine on .NET6
Setting COMPlus_GCName=libclrgc.so resolves the issue for our setup with .NET7
it'd be helpful to see what !ao displays (it's an sos extension). would that be possible? that's always the 1st step if you have a dump.
Setting COMPlus_GCName=libclrgc.so resolves the issue for our setup with .NET7
ok good to know, yeah like Maoni suggests getting a dump or trace can help confirm whether its the same issue. We hope to get it fixed in an upcoming servicing release.
Hopefully I did this right. I followed this guild. Here is the output:
---------Heap 1 ---------
Managed OOM occurred after GC #4 (Requested to allocate 6028264 bytes)
Reason: Could not do a full GC
thanks, it does look similar to other cases we have seen.
would it be possible to try out a private fix? we could deliver a libclrgc.so to you and you could use it the same way you used the shipped version. that would be really helpful.
That would probably be possible! Also while we're at it, is there any recommendation on how to get memory dumps from within a container?
I have copied a private libcoreclr.so at https://1drv.ms/u/s!AtaveiZOervriJhkWC64gVEV8dAHug?e=IyBaP3, if you want to give that a try. You will want to remove the COMPlus_GCName config.
@mangod9 @Maoni0 just got the chance to test today the library you sent, and after a day of usage under load no issues so far!
ok thanks for trying it out. We will do additional validation and add it to a .NET 7 servicing release (due to holidays might be in Feb).