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
[wasm-mt] AOT compilation with threading enabled results in out of bounds memory access #75474
install the wasm-experimental workload using dotnet workload install wasm-experimental
create a new app from the wasmbrowser template: dotnet new wasmbrowser
Publish with threads, AOT and trimming dotnet publish -c Release -p:RunAOTCompilation=true -p:PublishTrimmed=true -p:WasmEnableThreads=true
Result:
dotnet.js:5 Error: [MONO] * Assertion at /__w/1/s/src/mono/mono/metadata/exception.c:64, condition `is_ok (error)' not met, function:mono_exception_new_by_name, (null) assembly:System.Private.CoreLib.dll type:ArgumentException member:(null)
at ke (dotnet.js:5:509)
at Object.Ne (dotnet.js:5:792)
at _mono_wasm_trace_logger (dotnet.js:14:101296)
at :50266/dotnet.wasm
at :50266/dotnet.wasm
at :50266/dotnet.wasm
at :50266/dotnet.wasm
at :50266/dotnet.wasm
at :50266/dotnet.wasm
at :50266/dotnet.wasm
Ne @ dotnet.js:5
Turns out the problem was that the AOT cross compiler that we build for non-threaded WASM has some struct offsets hardcoded into it that are different on the threaded WASM runtime.
Activity
lambdageek commentedon Sep 12, 2022
I dont' think it's a trimmer issue: this is in the published System.Private.CoreLib.dll:
lambdageek commentedon Sep 12, 2022
Note also that
dotnet publish -c Release -p:WasmBuildNative=true -p:PublishTrimmed=true -p:WasmEnableThreads=trueworkslambdageek commentedon Sep 13, 2022
Turns out the problem was that the AOT cross compiler that we build for non-threaded WASM has some struct offsets hardcoded into it that are different on the threaded WASM runtime.
runtime/src/mono/mono/metadata/sgen-client-mono.h
Lines 43 to 48 in ecf9f2f
But the good news is those fields are both dead code (they're only ever initialized and never read from).
PR shortly