wapc / wapc-rust

Rust-based WebAssembly Host Runtime for waPC-compliant modules
Apache License 2.0
76 stars 10 forks source link

interrupt wasm module #23

Open srenatus opened 3 years ago

srenatus commented 3 years ago

Hi. I'm further diving into wapc, and there're some very nice ideas in there! 😃

One thing I could not find so far is, are you able to stop a guest call of it's taking too much time? In wasmtime, you'd use the interrupt handle to set a trap, but I don't see why of that used here. What's your approach? 🤔

autodidaddict commented 3 years ago

The wapc host runtime (Rust) supports multiple engines, wasm3 and wasmtime. As such we can't support things like aborting an execution unless both engines support it.

That said, wasmcloud, which builds on top of wapc, does have time limits and can abort calls, It just doesn't use the wasm engine to do it.

srenatus commented 3 years ago

That said, wasmcloud, which builds on top of wapc, does have time limits and can abort calls, It just doesn't use the wasm engine to do it.

Would you mind going into detail, or sharing a code link, please?

autodidaddict commented 3 years ago

Sure. If you take a look at wasmcloud in the wasmcloud host crate you'll see where we have a bunch of rpc timeouts.

That said, if a guest wasm spins into an infinite loop we do not currently have a way to shut that down gracefully, and we can use this issue to track that.

In short, the entire host will continue unbroken but that one module will be useless in that scenario and that's definitely something we need to take care of.