-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Low memory notifications for GC on Unix #6051
Comments
It looks like there is no low memory notification API in Linux and the only way is to poll /proc/meminfo regularly. |
The Same thing is happening on LXD. I had a quick chat with @janvorli at WUG Brno last week and he had pointed this issue out. Should I report it as a different issue?
|
@jbednarik1 actually, I was thinking about your issue after we've met and I've realized in your case, it might be a different issue that was fixed for 2.0.0. But I am not sure if you've said you were hitting it with 2.0.0 or with previous versions. |
Hi @janvorli. It seems to me we have solved our issue by setting GC to workstation mode. |
We can add the polling into the finalizer thread's For polling the current memory consumption, we can use the As for the threshold to trigger GC, we should probably use a percentage of the physical memory limit. We could make the percentage configurable via a new COMPlus_xxxx variable. We can try to set the default to something like 75%. To test the effect of the change, a simple application that allocates e.g. a byte array of a large size (e.g. 10 MB) in a loop and assigns it to the same variable, waiting for say 0.5 secs between the allocations would probably work. Running this application in a docker container with memory limited to e.g. 100MB on a host system with swap disabled and OOM killer enabled would result in the application getting killed without this change, but should result in its infinite survival with this change. |
Is there any plan to assign a milestone for this? I believe low memory notifications would resolve issues I'm having while running services in Docker that deal with a high volume of requests. I'm currently working around it by invoking the garbage collector manually on a schedule. |
Has anything changed around this in .NET Core 3.0? |
OK, I was wrong, the GC is taking by default into accounts memory limits outside of containers as well, as pointed out to me by @Maoni0 on Twitter https://twitter.com/maoni0/status/1164939641352404992?s=20 |
On Windows GC receives Low Memory notifications from the OS. Such functionality does not seem to exist on Unix. We need to investigate ideas how to deliver such information to the GC (user-mode polling strategy?) to help alleviate OOM and/or changes to allocation behaviors to reduce our OOM killer score on the process.
The text was updated successfully, but these errors were encountered: