-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v8.deserialize on WebAssembly module fails with "Unable to deserialize cloned data" #18265
Comments
Some printf debugging reveals that explicitly allowing WASM deserialization from source (over in-memory transfer) is necessary for this to work. I can't see why we can't allow it by default for /cc @addaleax |
Just flipping the flag isn't enough, we also need to implement We can probably do that the same way we implement That said, I remember there were a bunch of issues with WASM serialization. I don't know if V8 6.2 is in a shape where it actually works. |
Looks like this has been fixed now. https://runkit.com/saschanaz/5c84667c6e2ea0001222a59f |
Woot woot! Thanks for letting us know—and to whoever fixed it. |
It looks like this has regressed, the testcase here does not work on Same testcase, but with adding console.log('serlialized length:', buffer.length); between the serialization and deserialization, shows that with For comparison on Should I file a new issue? |
True, it doesn't work anymore in v14.1.0 while it works on v13.14.0. https://runkit.com/saschanaz/5ead9385cf032a001e521bc9 |
@kripken @saschanaz This has happened due to large changes to how the V8 API deals with compiled WASM modules – the new interfaces here are quite complex, and I’m not sure whether the APIs can be mapped against each other easily (and, in particular, synchronously). |
@addaleax Oh, that's too bad... this was really useful. An async API would be fine for the emscripten use cases, if that's possible! |
Note that this is broken on newer node, and mention where it works. see nodejs/node#18265 Show a proper error in SINGLE_FILE mode, where this can't work. Add a missing initialization so we always work properly. Better error logging.
Online REPL Reproduction
Using the experimental Serialization API calling
v8.serialize(module)
on a WebAssembly module works, however trying to then deserialize itv8.deserialize(buffer)
fails withError: Unable to deserialize cloned data.
.From what I gather, node is using a newly exposed API from v8, so it's possible that exposed API is to blame. Although, v8 itself supports it within its internal APIs and the --wasm_disable_structured_cloning flag is exposed in node v9.4.0 with the expected value of
false
(don't disable aka is enabled)A bit more real world example, for those curious:
This is supported in browsers via
postMessage
or saving them into IndexedDBNo urgency on my part, just logging mostly curious if someone can point me in the right direction codewise and I'll take a peek. I went down the rabbit hole on my own and didn't immediately see anything that would have prohibited support.
Cc/ @kwonoj
The text was updated successfully, but these errors were encountered: