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
[browser][MT] Memory growth on worker could cause failure #86642
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
Example of subsequent failure on main thread: the buffer is no longer instanceof SharedArrayBuffer but I think it's just disconnected.
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)
Activity
pavelsavara commentedon May 23, 2023
Something should probably proxy the resize call to all threads emscripten-core/emscripten#8365
lambdageek commentedon May 23, 2023
Resizing on worker threads should be fine, provided the main thread is using
Module.GROWABLE_HEAP_U8(and other views).I don't see how proxying to the main thread will help - in that case won't the workers have the same problem?
pavelsavara commentedon May 23, 2023
Our TS code doesn't use
Module.GROWABLE_HEAP_U8yet.pavelsavara commentedon May 24, 2023
We could disable usage of TextDecoder in emscripten by
-s TEXTDECODER=0and in our code by other means.This seems to be related discussions
emscripten-core/emscripten#18034
emscripten-core/emscripten#15217
In the reported case it's not an
iframe.