Skip to content

[browser][MT] Memory growth on worker could cause failure #86642

@pavelsavara

Description

@pavelsavara

When we compile the runtime with /p:MonoWasmBuildVariant=multithread and the web worker would cause memory growth, the linear memory buffer is disconnected from the original buffer on the main thread.

Example of allocation and resize on worker
image

Example of subsequent failure on main thread: the buffer is no longer instanceof SharedArrayBuffer but I think it's just disconnected.
image

Leads to

MONO_WASM: TypeError: Failed to execute 'decode' on 'TextDecoder': The provided ArrayBufferView value must not be shared.
    at UTF8ArrayToString (http://localhost:8000/dotnet.native.js:379:22)
    at Object.UTF8ToString (http://localhost:8000/dotnet.native.js:412:15)
    at mono_wasm_trace_logger (http://localhost:8000/dotnet.runtime.js:211:32)
    at wasm_trace_logger (http://localhost:8000/dotnet.native.wasm:wasm-function[142]:0x11902)
    at callback_adapter (http://localhost:8000/dotnet.native.wasm:wasm-function[872]:0x58eec)
    at mono_tracev_inner (http://localhost:8000/dotnet.native.wasm:wasm-function[867]:0x58cfb)
    at mono_trace.13 (http://localhost:8000/dotnet.native.wasm:wasm-function[5213]:0x15b333)
    at mono_runtime_class_init_full (http://localhost:8000/dotnet.native.wasm:wasm-function[5206]:0x15ab4e)
    at do_init_vtable (http://localhost:8000/dotnet.native.wasm:wasm-function[294]:0x2793e)
    at mono_interp_exec_method (http://localhost:8000/dotnet.native.wasm:wasm-function[277]:0x1ec85)

on the main thread.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions