You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
.NET 7 console executable fails with 'Failed to create CoreCLR, HRESULT: 0x8007000E' on Debian Linux (Seedbox) #79612
@rcdailey this error code means "out of memory", so the diagnostics log you've shared doesn't help. The "out of memory" also really means "out of resources", so it could be out of file descriptor limit. Although it is unlikely to happen at coreclr initialization time.
strace log should show the source of the issue. You can capture it using strace -o stracelog.txt -f /path/to/your/app. The -f means "follow children".
strace logs syscalls and their return values, so if e.g. mmap fails, or open fails, it would show up.
The user says they aren't allowed to run strace. I don't know why. They said it's a "shared" environment, but I don't know exactly what that means. I assume that has something to do with why he cants run it?
Are there other diagnostic commands that can be run?
I think I can see the problem. The ulimit for virtual memory is set to just 10GB. We expect virtual memory space to be unlimited (on 64 bit systems each process can use upto about 128TB of virtual address space if the limit is not set). GC reserves large virtual address range for the heap, which is almost for sure the reason for the out of memory failure. It is something that we would like to fix in the future, since there were already few cases where people have hit this limitation. See the discussion in the #7740 for more details.
Your user can try to limit the amount of virtual memory used by the GC using the environment variable
DOTNET_GCHeapHardLimit=1C0000000
This would limit GC heap max size to 7GB.
There are other ways to achieve similar thing, but this is the most straightforward for the current case.
@janvorli Thanks once again for hopping over to the source issue to help. Greatly appreciated.
Now that the user has a workaround, what's the conclusion here? It seems like this was an environment-specific issue on their side and there is no change needed here.
At the very least I've learned some good diagnostic commands to run next time this happens. Feel free to close out this issue if you feel nothing else is needed.
@rcdailey I am going to add detection of a set virtual memory limit to our runtime so that in future, the workaround of limiting the GC heap size would not be needed. We've discussed that in the past already, but as the case when there is a virtual memory limit set is a very rare case, it didn't make it high enough in the priority list of work.
But since it surfaced again now, I am going to prioritize it.
@janvorli, would it make sense to include some stats (fromGlobalMemoryStatusEx() etc.) in this error message?
I was trying to figure out why a simple hello world refuses to run without procfs although we have fallbacks in place.
Here is an experiment with installer daily build 8.0.100-preview.2.23117.18 (includes exe path fix)
# host machine: osx-arm64: publish for linux-arm# create and publish net8.0 linux-arm app
$ dotnet new console -n exe1
$ dotnet publish exe1 -p:InvariantGlobalization=true --self-contained -r linux-arm64 -o dist
# interactively run a privileged container so we can later unmount procfs
$ docker run -v$(pwd)/dist:/app --privileged -it ubuntu
# run the app
$ /app/exe1
Hello, World!# un-mount procfs and try again
$ umount /proc
$ /app/exe1
Failed to create CoreCLR, HRESULT: 0x8007000E
# diagnose ...
$ sh -c 'apt update && apt install -y strace curl'&>/dev/null
$ strace -f /app/exe1 2>&1| curl -F"sprunge=<-" http://sprunge.us
http://sprunge.us/VE1Gcg
$ getconf -a | grep -i page
PAGESIZE 4096
PAGE_SIZE 4096
_AVPHYS_PAGES 1636833
_PHYS_PAGES 3770763
# so it should be limited to {PAGE * _AVPHYS_PAGES} to match PAL and GC?
$ printf'%X\n'$(($(getconf PAGESIZE) * $(getconf _AVPHYS_PAGES)))
18FD5E000
$ DOTNET_GCHeapHardLimit=18FD5E000 /app/exe1
Failed to create CoreCLR, HRESULT: 0x8007000E
# try with some small limit
$ DOTNET_GCHeapHardLimit=12345678 /app/exe1
Failed to create CoreCLR, HRESULT: 0x8007000E
# remount /proc to go back to working state
$ mount -t proc proc /proc
FWIW, nativeaot published apps work fine without procfs; when it's completely absent or when it's inaccessible (in constrained environment).
Activity
janvorli commentedon Dec 13, 2022
@rcdailey this error code means "out of memory", so the diagnostics log you've shared doesn't help. The "out of memory" also really means "out of resources", so it could be out of file descriptor limit. Although it is unlikely to happen at coreclr initialization time.
stracelog should show the source of the issue. You can capture it usingstrace -o stracelog.txt -f /path/to/your/app. The-fmeans "follow children".strace logs syscalls and their return values, so if e.g.
mmapfails, oropenfails, it would show up.Also, I have just added logging of extended information on coreclr initialization failures in the current main. If you could provide your user a version of your app built against main (using SDK from https://github.com/dotnet/installer), that also might shed a light on where the OOM came from.
rcdailey commentedon Dec 14, 2022
The user says they aren't allowed to run strace. I don't know why. They said it's a "shared" environment, but I don't know exactly what that means. I assume that has something to do with why he cants run it?
Are there other diagnostic commands that can be run?
Thanks for your help.
janvorli commentedon Dec 14, 2022
It would be interesting to know how much memory the environment has and few other details like this. Here are some commands to get it:
cat /proc/meminfo ulimit -aI also wonder - is the user running it in some sort of container that could limit the memory for the process (like docker, etc)?
rcdailey commentedon Dec 14, 2022
@janvorli Here are the outputs of those commands:
As for the second question i dont think so. I think its more of different VM's on a machine shared across users.
Thanks for your continued support!
janvorli commentedon Dec 15, 2022
I think I can see the problem. The ulimit for virtual memory is set to just 10GB. We expect virtual memory space to be unlimited (on 64 bit systems each process can use upto about 128TB of virtual address space if the limit is not set). GC reserves large virtual address range for the heap, which is almost for sure the reason for the out of memory failure. It is something that we would like to fix in the future, since there were already few cases where people have hit this limitation. See the discussion in the #7740 for more details.
Your user can try to limit the amount of virtual memory used by the GC using the environment variable
This would limit GC heap max size to 7GB.
There are other ways to achieve similar thing, but this is the most straightforward for the current case.
rcdailey commentedon Dec 15, 2022
@janvorli Thanks once again for hopping over to the source issue to help. Greatly appreciated.
Now that the user has a workaround, what's the conclusion here? It seems like this was an environment-specific issue on their side and there is no change needed here.
At the very least I've learned some good diagnostic commands to run next time this happens. Feel free to close out this issue if you feel nothing else is needed.
janvorli commentedon Dec 15, 2022
@rcdailey I am going to add detection of a set virtual memory limit to our runtime so that in future, the workaround of limiting the GC heap size would not be needed. We've discussed that in the past already, but as the case when there is a virtual memory limit set is a very rare case, it didn't make it high enough in the priority list of work.
But since it surfaced again now, I am going to prioritize it.
am11 commentedon Feb 21, 2023
@janvorli, would it make sense to include some stats (from
GlobalMemoryStatusEx()etc.) in this error message?I was trying to figure out why a simple hello world refuses to run without procfs although we have fallbacks in place.
Here is an experiment with installer daily build
8.0.100-preview.2.23117.18(includes exe path fix)FWIW, nativeaot published apps work fine without procfs; when it's completely absent or when it's inaccessible (in constrained environment).
mangod9 commentedon Jul 24, 2023
Closing since the original question is resolved.