diff --git a/lib/api/src/js/module.rs b/lib/api/src/js/module.rs index 61866abcf5f..adc61d6b08b 100644 --- a/lib/api/src/js/module.rs +++ b/lib/api/src/js/module.rs @@ -44,14 +44,10 @@ pub struct Module { raw_bytes: Option, } -// Module implements `structuredClone` in js, so it's safe it to make it Send. -// https://developer.mozilla.org/en-US/docs/Web/API/structuredClone -// ```js -// const module = new WebAssembly.Module(new Uint8Array([ -// 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00 -// ])); -// structuredClone(module) -// ``` +// XXX +// Do not rely on `Module` being `Send`: it will panic at runtime +// if accessed from multiple threads thanks to [`JsHandle`]. +// See https://github.com/wasmerio/wasmer/issues/4158 for details. unsafe impl Send for Module {} unsafe impl Sync for Module {}