cunarist / tokio-with-wasm

Mimicking tokio functionalies on web browsers
MIT License
46 stars 4 forks source link

Memory error with WorkerPool `spawn_blocking` #19

Open Slixe opened 5 days ago

Slixe commented 5 days ago

Hey, it's me again.

Here is the log I'm getting:

Error from `flush_queued_tasks` in `tokio-with-wasm`: JsValue(DataCloneError: Failed to execute 'postMessage' on 'Worker': #<Memory> could not be cloned.
DataCloneError: Failed to execute 'postMessage' on 'Worker': #<Memory> could not be cloned.

with the following minimal example (which is from your spawn_blocking function doc: https://github.com/Slixe/xelis-captcha

Building with no-module or web target don't change anything.

Am I missing anything ? I've followed https://github.com/cunarist/tokio-with-wasm?tab=readme-ov-file#building-and-deploying with no success.

temeddix commented 4 days ago

I was able to make your example work by providing some extra arguments to the typical wasm-pack command.

The compile.py file that I wrote be of help.

Slixe commented 4 days ago

Thanks a lot, maybe it would be worth adding it in the README too ?

I thought everything was fine, but the error was on me, sorry!

Slixe commented 14 hours ago

@temeddix sorry to ping you, should I do a PR to add the missing part in the README.md in order to prevent any issues like mine ?

temeddix commented 14 hours ago

Yeah, adding relevant info to the readme file would be a big help. I'm personally busy right now, so any kind of PR for that would be greatly appreciated :)

b-zee commented 13 hours ago

I just came across this issue, but am running wasm-pack test. Testing doesn't support arguments like --target=web, so not sure if it's possible at all.

Am I understanding correctly that a nightly compiler is needed in combination with passing -Z build-std=std,panic_abort?