Repository navigation
Description
Description
We are running an angular application that creates and starts the runtime with Blazor.start and getDotnetRuntime(0). At some point our application gets this runtime error:
RuntimeError: memory access out of bounds
at dotnet.native.wasm.mono_jiterp_tlqueue_purge_all (http://localhost:4200/assets/dotnet/dotnet.native.sg2y5d2zcg.wasm:wasm-function[446]:0x43172)
at dotnet.native.wasm.mono_jiterp_free_method_data (http://localhost:4200/assets/dotnet/dotnet.native.sg2y5d2zcg.wasm:wasm-function[445]:0x430b0)
at dotnet.native.wasm.interp_free_method (http://localhost:4200/assets/dotnet/dotnet.native.sg2y5d2zcg.wasm:wasm-function[156]:0x1af71)
at dotnet.native.wasm.mono_jit_free_method (http://localhost:4200/assets/dotnet/dotnet.native.sg2y5d2zcg.wasm:wasm-function[4792]:0x139620)
at dotnet.native.wasm.mono_runtime_free_method (http://localhost:4200/assets/dotnet/dotnet.native.sg2y5d2zcg.wasm:wasm-function[3661]:0xfb211)
at dotnet.native.wasm.free_dynamic_method (http://localhost:4200/assets/dotnet/dotnet.native.sg2y5d2zcg.wasm:wasm-function[4255]:0x1187c7)
at dotnet.native.wasm.reference_queue_process (http://localhost:4200/assets/dotnet/dotnet.native.sg2y5d2zcg.wasm:wasm-function[4418]:0x1252f7)
at dotnet.native.wasm.mono_runtime_do_background_work (http://localhost:4200/assets/dotnet/dotnet.native.sg2y5d2zcg.wasm:wasm-function[4403]:0x124ebe)
at dotnet.native.wasm.mono_background_exec (http://localhost:4200/assets/dotnet/dotnet.native.sg2y5d2zcg.wasm:wasm-function[1188]:0x5319a)
at Yo (http://localhost:4200/assets/dotnet/dotnet.runtime.26xtx0erx2.js:3:55978)
This issue seems to be in the jiterpreter and we wanted to see what would happen when we disable this with the following settings:
<BlazorWebAssemblyJiterpreter>false</BlazorWebAssemblyJiterpreter>
<WasmBuildNative>true</WasmBuildNative>
<WasmNativeDebugSymbols>true</WasmNativeDebugSymbols>
<DebuggerSupport>true</DebuggerSupport>
<CompressionEnabled>false</CompressionEnabled>
<WasmNativeStrip>false</WasmNativeStrip>
<BlazorCacheBootResources>false</BlazorCacheBootResources>This will add the following options to the blazor.boot.json file:
[
"--no-jiterpreter-traces-enabled",
"--no-jiterpreter-interp-entry-enabled",
"--no-jiterpreter-jit-call-enabled"
]But this does not seem to disable calling that method and results in the same runtime error.
Reproduction Steps
I am unable to provide a small sample that can be used to reproduce this issue.
Expected behavior
Setting <BlazorWebAssemblyJiterpreter>false</BlazorWebAssemblyJiterpreter> should disable the call to mono_jiterp_tlqueue_purge_all.
Actual behavior
The method is called.
Regression?
No response
Known Workarounds
No response
Configuration
.NET 9.0.100-rc.1.24452.12
Microsoft.AspNetCore.Components.WebAssembly 9.0.0-rc.1.24452.1
Other information
@pavelsavara was in a teams call where this runtime error was happening.
Activity
dotnet-policy-service commentedon Oct 3, 2024
Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.
dotnet-policy-service commentedon Oct 3, 2024
Tagging subscribers to this area: @BrzVlad, @kotlarmilos
See info in area-owners.md if you want to be subscribed.
pavelsavara commentedon Oct 3, 2024
cc @kg
I wonder why the jiterp was not disabled by the flags.
2 remaining items
kg commentedon Oct 4, 2024
This bit of functionality is probably not guarded by the jiterpreter pref. It's a bit surprising that it's able to run during your application startup - this would require you to be creating enough dynamic methods to run out of memory and cause them to get GC'd. It shouldn't be too hard to prepare a fix, so I'll look into it.
pavelsavara commentedon Oct 4, 2024
Maybe the application is heavily using
OnPropertyChangeevents/delegates ?dlemstra commentedon Oct 4, 2024
The application where we are experiencing this runtime error is using a lot of
OnPropertyChangeevents.pavelsavara commentedon Oct 4, 2024
We also learned that the
mono_jiterp_tlqueue_purge_allexception appears also when the jiterp is enabled. It seems thatmono_jiterp_tlqueue_purge_allwould be executed before any jiterp tier-up ?[-]RuntimeError: memory access out of bounds at dotnet.native.wasm.mono_jiterp_tlqueue_purge_all[/-][+][browser] RuntimeError: memory access out of bounds at dotnet.native.wasm.mono_jiterp_tlqueue_purge_all[/+][wasm] Fixes for issue #108519 (#108543)
[wasm] Fixes for issue dotnet#108519 (dotnet#108543)
[release/9.0] [wasm] Fixes for issue #108519 (#108650)
GokulprasathVenkatachalam commentedon Oct 18, 2024
Hi Team,
We have updated to the latest .NET 9 RC2 and Visual Studio Preview, but we are still encountering a similar issue in our Blazor WASM project with SkiaSharp. The error details are as follows:
We are also experiencing a similar issue after updating to SkiaSharp Preview 5.3:
Could you please confirm if these memory access out of bounds issues are resolved in the .NET 9 release or if there are any other packages that address this problem?
Regards,
Gokulprasath
pavelsavara commentedon Oct 18, 2024
This is hopefully fixed in GA #108650
We didn't have a way to reproduce
dlemstra commentedon Nov 13, 2024
I can confirm that this is fixed for us with
net9.0.[wasm] Fixes for issue dotnet#108519 (dotnet#108543)