dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.18k stars 4.72k forks source link

[wasm][aot] Windows: `mono-aot-cross` crashes with 0xC0000374 compiling `MessagePack.dll` #53546

Closed radical closed 3 years ago

radical commented 3 years ago

Based off #53314 .

Steps to reproduce:

Fails while running mono-aot-cross for MessagePack.dll:

Running: C:\Program Files\dotnet\packs\microsoft.netcore.app.runtime.aot.win-x64.cross.browser-wasm\6.0.0-preview.4.21222.10\Sdk\..\tools\mono-aot-cross.exe --debug
--llvm "--aot=no-opt,static,direct-icalls,deterministic,nodebug,llvm-path=C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.2.0.12.Sdk.win-x64\6.0.0-preview.4.21220.1\tools\bin\,llvmonly,interp,asmonly,llvm-outfile=C:\dev\bl0\obj\release\net6.0\wasm\MessagePack.dll.bc" MessagePack.dll (TaskId:134)
       Using working directory: C:\dev\bl0\obj\release\net6.0\linked (TaskId:134)
       Setting environment variables for execution: (TaskId:134)
           MONO_PATH = C:\dev\bl0\obj\release\net6.0\linked;C:\Users\Ankit Jain\.nuget\packages\microsoft.netcore.app.runtime.mono.browser-wasm\6.0.0-preview.4.21253.7\runtimes\browser-wasm\native\;C:\Users\Ankit Jain\.nuget\packages\microsoft.netcore.app.runtime.mono.browser-wasm\6.0.0-preview.4.21253.7\runtimes\browser-wasm\\lib\net6.0 (TaskId:134)
           MONO_ENV_OPTIONS =  (TaskId:134)

Exit code: -1073740940 (TaskId:134)

System.Exception: Error:

  at Utils.RunProcess(String path, String args, IDictionary`2 envVars, String workingDir, Boolean ignoreErrors, Boolean silent, MessageImportance outputMessageImportance, MessageImportance debugMessageImportance) in MonoAOTCompiler.dll:token 0x600002f+0x1fd
  at MonoAOTCompiler.PrecompileLibrary(ITaskItem assemblyItem, String monoPaths) in MonoAOTCompiler.dll:token 0x600002b+0x436 (TaskId:134)

exit code -1073740940(0xC0000374, heap corruption?)

cc @vargaz @lewing @radekdoulik @steveisok

ghost commented 3 years ago

Tagging subscribers to 'arch-wasm': @lewing See info in area-owners.md if you want to be subscribed.

Issue Details
Based off #53314 . Steps to reproduce: - install dotnet preview 4 (dotnet.microsoft.com/download/dotnet/6.0), into a system location - install the workload packs with: dotnet workload install microsoft-net-sdk-blazorwebassembly-aot. You would need to run that as root - create a new blazor project with dotnet new blazorwasm - Add `true`, and `` to the project - build with `dotnet publish -c:release -p:RunAOTCompilation=true -bl` Fails while running `mono-aot-cross` for `MessagePack.dll`: ``` Running: C:\Program Files\dotnet\packs\microsoft.netcore.app.runtime.aot.win-x64.cross.browser-wasm\6.0.0-preview.4.21222.10\Sdk\..\tools\mono-aot-cross.exe --debug --llvm "--aot=no-opt,static,direct-icalls,deterministic,nodebug,llvm-path=C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.2.0.12.Sdk.win-x64\6.0.0-preview.4.21220.1\tools\bin\,llvmonly,interp,asmonly,llvm-outfile=C:\dev\bl0\obj\release\net6.0\wasm\MessagePack.dll.bc" MessagePack.dll (TaskId:134) Using working directory: C:\dev\bl0\obj\release\net6.0\linked (TaskId:134) Setting environment variables for execution: (TaskId:134) MONO_PATH = C:\dev\bl0\obj\release\net6.0\linked;C:\Users\Ankit Jain\.nuget\packages\microsoft.netcore.app.runtime.mono.browser-wasm\6.0.0-preview.4.21253.7\runtimes\browser-wasm\native\;C:\Users\Ankit Jain\.nuget\packages\microsoft.netcore.app.runtime.mono.browser-wasm\6.0.0-preview.4.21253.7\runtimes\browser-wasm\\lib\net6.0 (TaskId:134) MONO_ENV_OPTIONS = (TaskId:134) Exit code: -1073740940 (TaskId:134) System.Exception: Error: at Utils.RunProcess(String path, String args, IDictionary`2 envVars, String workingDir, Boolean ignoreErrors, Boolean silent, MessageImportance outputMessageImportance, MessageImportance debugMessageImportance) in MonoAOTCompiler.dll:token 0x600002f+0x1fd at MonoAOTCompiler.PrecompileLibrary(ITaskItem assemblyItem, String monoPaths) in MonoAOTCompiler.dll:token 0x600002b+0x436 (TaskId:134) ``` exit code `-1073740940`(0xC0000374, heap corruption?) cc @vargaz @lewing @radekdoulik @steveisok
Author: radical
Assignees: -
Labels: `arch-wasm`, `area-Codegen-AOT-mono`
Milestone: -
vargaz commented 3 years ago

Need some kind of stacktrace in order to track this down.

sxotney commented 3 years ago

@vargaz I'm happy to provide one here only it's a bit tricky to get at so would need some help in the right direction.

The output is already using diagnostic verbosity. From what I understand AOT build comes after C# converts to IL and then to C, so I take it I need to run the correct emscripten against a packaged dll?

lewing commented 3 years ago

@sxotney are you able to reproduce this with later previews?

sxotney commented 3 years ago

I tried just this week with 6.0.0-preview.6.21355.2 and the issue still occurs. I'll try a preview 7 and revert back asap

sxotney commented 3 years ago

Still happening in 6.0.0-preview.7.21363.16

lewing commented 3 years ago

cc @vargaz

sxotney commented 3 years ago

FYI - Still present in 6.0.0-rc.1.21376.1