Skip to content

Blazor: Running Module.malloc too early? #13915

Closed
@kg

Description

@kg

Describe the bug

Blazor appears to be potentially invoking emscripten/mono APIs before mono has actually loaded - there's some logic being executed in preRun that chains some callbacks that can call malloc, which will assert and fail. I'm seeing it in my local execution environment. It could have something to do with the fact that I'm testing a newer build of mono, but there aren't any changes that would cause this problem and it appears that blazor is doing something incorrect.

To Reproduce

Steps to reproduce the behavior:

  1. Follow the directions at https://docs.microsoft.com/en-us/aspnet/core/tutorials/build-your-first-blazor-app?view=aspnetcore-3.0
  2. Replace the mono.js + mono.wasm with a recent from-source build

Expected behavior

Something mostly functions

I think the correct behavior here is for the malloc call (and other calls out to emscripten/mono APIs) to be queued to occur after mono has actually started. I'm a little surprised that these callbacks could run this early but I suppose there's no reason they couldn't (unless this is a violation of some obscure promise ordering spec)

Screenshots

image
image

Additional context

kate@reeir-debian2:~/Projects/blazortest$ dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.0.100-preview9-014004
 Commit:    8e7ef240a5

Runtime Environment:
 OS Name:     debian
 OS Version:  10
 OS Platform: Linux
 RID:         debian.10-x64
 Base Path:   /usr/share/dotnet/sdk/3.0.100-preview9-014004/

Host (useful for support):
  Version: 3.0.0-preview9-19423-09
  Commit:  2be172345a

.NET Core SDKs installed:
  2.2.402 [/usr/share/dotnet/sdk]
  3.0.100-preview9-014004 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.2.7 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.2.7 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0-preview9.19424.4 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.2.7 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0-preview9-19423-09 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

Metadata

Metadata

Labels

area-blazorIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.feature-blazor-wasmThis issue is related to and / or impacts Blazor WebAssembly

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions