runtime: crash with 0x8007000E error on .NET 7.0

Description

dotnet --version, dotnet build commands crash with 0x8007000E error.

ubuntu@localhost:~$ dotnet --version
GC heap initialization failed with error 0x8007000E
Failed to create CoreCLR, HRESULT: 0x8007000E

Reproduction Steps

Install dotnet 7.0 sdk with dotnet_install.sh script and run dotnet --version command on terminal

Expected behavior

print dotnet version

Actual behavior

ubuntu@localhost:~$ dotnet --version
GC heap initialization failed with error 0x8007000E
Failed to create CoreCLR, HRESULT: 0x8007000E

I also run command with strace: stracelog.txt

Regression?

works perfectly on .NET 6.0.4 SDK

Known Workarounds

I solved the problem with this

ubuntu@localhost:~/.dotnet$ DOTNET_GCHeapHardLimit=1C0000000 dotnet --version
7.0.203

However why this occurs on .NET 7.0? On .NET 6.0 works without any problem

Configuration

ubuntu jammy, ARM64, run on Termux (Android 13)

Other information

ubuntu@localhost:~/.dotnet$ ulimit -v
unlimited                                                           
ubuntu@localhost:~/.dotnet$ cat /proc/meminfo
MemTotal:        7475488 kB                                          MemFree:          214228 kB
MemAvailable:    1438284 kB                                          Buffers:             756 kB
Cached:          1464412 kB                                          SwapCached:        22804 kB
Active:          1207476 kB                                          Inactive:        1771804 kB
Active(anon):     639508 kB                                          Inactive(anon):  1270248 kB
Active(file):     567968 kB                                          Inactive(file):   501556 kB
Unevictable:       19004 kB                                          Mlocked:           16752 kB
RbinTotal:        327680 kB                                          RbinAlloced:        7168 kB
RbinPool:              0 kB                                          RbinFree:             80 kB
RbinCached:       320432 kB                                          ZeroedFree:            0 kB
SwapTotal:       4194300 kB                                          SwapFree:        1015972 kB
Dirty:               620 kB                                          Writeback:             0 kB
AnonPages:       1845132 kB                                          Mapped:           902216 kB
Shmem:             60352 kB                                          KReclaimable:     315004 kB                                          Slab:             589340 kB
SReclaimable:     146800 kB                                          SUnreclaim:       442540 kB
KernelStack:       97984 kB
ShadowCallStack:   24532 kB
PageTables:       209516 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     7768204 kB
Committed_AS:   238931928 kB
VmallocTotal:   263061440 kB                                         VmallocUsed:      257124 kB
VmallocChunk:          0 kB                                          Percpu:            12544 kB
AnonHugePages:         0 kB                                          ShmemHugePages:        0 kB
ShmemPmdMapped:        0 kB                                          FileHugePages:         0 kB
FilePmdMapped:         0 kB                                          HugepagePool:          0 kB
CmaTotal:         487424 kB                                          CmaFree:            4976 kB
dma_heap_pool:    104732 kB                                          system:           569356 kB
kgsl_pool:         63656 kB
KgslSharedmem:   1044500 kB
zram0:            850656 kB
ubuntu@localhost:~/.dotnet$ dotnet --info
GC heap initialization failed with error 0x8007000E
Failed to create CoreCLR, HRESULT: 0x8007000E

Host:
  Version:      7.0.5
  Architecture: arm64
  Commit:       8042d61b17
                                                                     .NET SDKs installed:
  7.0.203 [/home/ubuntu/.dotnet/sdk]                                 
.NET runtimes installed:                                               Microsoft.AspNetCore.App 7.0.5 [/home/ubuntu/.dotnet/shared/Microsoft.AspNetCore.App]                                                     Microsoft.NETCore.App 7.0.5 [/home/ubuntu/.dotnet/shared/Microsoft.NETCore.App]                                                         
Other architectures found:                                             None
                                                                     Environment variables:
  Not set                                                            
global.json file:                                                      Not found
                                                                     Learn more:                                                            https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download
ubuntu@localhost:~/.dotnet$ dotnet --version
GC heap initialization failed with error 0x8007000E                  Failed to create CoreCLR, HRESULT: 0x8007000E

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 15 (9 by maintainers)

Most upvoted comments

hmm, yeah guess we need to limit it based on the VM alloc limits. @AlphaBs, assume you have a workaround to manually set the heap hard limit for now?

yes. I just added export DOTNET_GCHeapHardLimit=1C0000000 to .bashrc. It works well.

As I tweaked that variable, I found that the limit point was roughly at b26000000. (47882174464 bytes, 47GB)

I also found that this limit is not fixed, but varies from run to run (perhaps depending on memory usage of machine during execution).

here is the result of running the command repeatedly, with DOTNET_GCHeapHardLimit=b26000000`.

ubuntu@localhost:~$ dotnet --version
GC heap initialization failed with error 0x8007000E
Failed to create CoreCLR, HRESULT: 0x8007000E
ubuntu@localhost:~$ free
               total        used        free      shared  buff/cache   available
Mem:         7475488     5316836      345408       44060     1813244     2088116
Swap:        4194300     2724232     1470068
ubuntu@localhost:~$ dotnet --version
7.0.203
ubuntu@localhost:~$ free
               total        used        free      shared  buff/cache   available
Mem:         7475488     5313228      348764       44060     1813496     2091708
Swap:        4194300     2724232     1470068
ubuntu@localhost:~$ dotnet --version
GC heap initialization failed with error 0x8007000E
Failed to create CoreCLR, HRESULT: 0x8007000E
ubuntu@localhost:~$ dotnet --version
GC heap initialization failed with error 0x8007000E
Failed to create CoreCLR, HRESULT: 0x8007000E
ubuntu@localhost:~$ free
               total        used        free      shared  buff/cache   available
Mem:         7475488     5325684      262436       46936     1887368     1957008
Swap:        4194300     2826736     1367564
ubuntu@localhost:~$ dotnet --version
7.0.203
ubuntu@localhost:~$

During the execution the usage of memory:

Screenshot_20230503_153440_Termux.jpg

As you can see, the error doesn’t always occur with b26000000 limit. But I don’t know what this magic number b26000000 means.

Any ideas??