Skip to content
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

dotNET 7 core crashes with GC heap initialization #283

Open
zavocc opened this issue Aug 20, 2023 · 3 comments
Open

dotNET 7 core crashes with GC heap initialization #283

zavocc opened this issue Aug 20, 2023 · 3 comments

Comments

@zavocc
Copy link

zavocc commented Aug 20, 2023

Problem description
DotNET 7 SDK installed on Ubuntu 22.04 arm64 but most commands such as dotnet new dotnet --help shows GC heap initialization error without doing anything, just crashes

root@localhost:~# dotnet new console
GC heap initialization failed with error 0x8007000E
Failed to create CoreCLR, HRESULT: 0x8007000E
root@localhost:~# dotnet --help
GC heap initialization failed with error 0x8007000E
Failed to create CoreCLR, HRESULT: 0x8007000E
root@localhost:~# dotnet --info
GC heap initialization failed with error 0x8007000E
Failed to create CoreCLR, HRESULT: 0x8007000E

Host:
  Version:      7.0.10
  Architecture: arm64
  Commit:       a6dbb800a4

.NET SDKs installed:
  7.0.110 [/usr/lib/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 7.0.10 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 7.0.10 [/usr/lib/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
root@localhost:~#

Steps to reproduce
This happens on Ubuntu 22.04 arm64 proot installation

  1. Install proot-distro and Ubuntu proot-distro install ubuntu
  2. Update packages and install dotNET SDK apt install dotnet-sdk-7.0
  3. Run some dotNET commands such as dotnet --help dotnet new console dotnet run dotnet store yields GC initialization failure (some still does it's job like dotnet --info but with error about gc init failure)

Expected behavior
It should not crash with GC initialization failure

Additional information

Termux Variables:
TERMUX_API_VERSION=0.50.1
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=19765
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://packages-cf.termux.dev/apt/termux-main/ stable main
# x11-repo (sources.list.d/x11.list)
deb https://packages-cf.termux.dev/apt/termux-x11/ x11 main
Updatable packages:
command-not-found/stable 2.2.0-13 aarch64 [upgradable from: 2.2.0-12]
vulkan-headers/stable 1.3.261 all [upgradable from: 1.3.260]
vulkan-loader-generic/stable 1.3.261 aarch64 [upgradable from: 1.3.259]
zlib/stable 1.3 aarch64 [upgradable from: 1.2.13]
termux-tools version:
1.38.5
Android version:
11
Kernel build information:
Linux localhost 4.14.180-perf+ #2 SMP PREEMPT Sat Sep 3 23:17:03 CST 2022 aarch64 Android
Device manufacturer:
OPPO
Device model:
CPH1933
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
Installed termux plugins:
com.termux.api versionCode:51
com.termux.x11 versionCode:14

Not sure for older versions of dotnet if it exhibits the same behavior

@zavocc
Copy link
Author

zavocc commented Aug 20, 2023

Tried dotNET 6 and it works when creating new project and other command line options (./dotnet6/dotnet new console -n HelloWorldApp) however building a sample app stumbled upon csc.dll error.

root@localhost:~# ./dotnet6/dotnet build HelloWorldAPP
MSBuild version 17.3.2+561848881 for .NET
  Determining projects to restore...
  All projects are up-to-date for restore.
/root/dotnet6/sdk/6.0.413/Roslyn/Microsoft.CSharp.Core.targets(75,5): error MSB6006: "csc.dll" exited with code 139. [/root/HelloWorldAPP/HelloWorldAPP.csproj]

Build FAILED.

/root/dotnet6/sdk/6.0.413/Roslyn/Microsoft.CSharp.Core.targets(75,5): error MSB6006: "csc.dll" exited with code 139. [/root/HelloWorldAPP/HelloWorldAPP.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:30.05

Might be related to this?
dotnet/runtime#57558

@michalbednarski
Copy link
Collaborator

strace shows:

mmap(NULL, 274877915136, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory)

(On Pixel 6, on Raspberry Pi 4 same call has succeeded)

Googling "274877915136 bytes" number leads to dotnet/runtime#85556
where export DOTNET_GCHeapHardLimit=1C0000000 is offered as workaround

@zavocc
Copy link
Author

zavocc commented Aug 22, 2023

Setting that environment variable makes dotNET 7 works like a charm

Screenshot_20230821-231043~2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants