Stream: git-wasmtime

Topic: wasmtime / issue #8687 Interruptible timeout in wasm


view this post on Zulip Wasmtime GitHub notifications bot (May 23 2024 at 14:39):

redoC-A2k opened issue #8687:

I want to wait / sleep or run a function after timeout of some seconds in wasm32-wasi component ? But I want that to be cancellable .
I tried doing this - https://stackoverflow.com/a/70121550 But I got error - failed to spawn thread: Error { kind: Unsupported, message: "operation not supported on this platform" } on spawning thread , I have tried compiling my rust to wasm32-wasip1-threads and on host I have make sure to enable wasm_threads support by config.wasm_threads(true).

What else do I need to do ?

view this post on Zulip Wasmtime GitHub notifications bot (May 23 2024 at 14:53):

alexcrichton commented on issue #8687:

If you're the host then you can use Wasmtime's async support in conjunction with epochs or fuel to interrupt WebAssembly that's currently executing.

If you're the guest then the main way to block right now is through the "poll"-style interfaces which have a timeout parameter. You'll need to coordinate within the guest to ensure that this timeout is configured accordingly.

view this post on Zulip Wasmtime GitHub notifications bot (May 23 2024 at 15:10):

redoC-A2k commented on issue #8687:

Could you explain more please ? If you can provide some documentations and demo github examples that will be great . I was expecting on guest side interrupt but I saw here - https://github.com/dicej/component-async-demo that @dicej has been using his local fork of wasmtime and other wasm-tools . So I thought may be the async thing is not ready and not available right now .

view this post on Zulip Wasmtime GitHub notifications bot (May 23 2024 at 15:11):

redoC-A2k edited a comment on issue #8687:

Could you explain more please ? If you can provide some documentations and demo github examples that will be great . I was expecting on guest side interrupt but I saw here - https://github.com/dicej/component-async-demo that @dicej has been using his local fork of wasmtime and other wasm-tools . So I thought may be the async thing is not ready and not available right now . Also I am using right now 19 version of wasmtime and related tools (wasmtime-wasi , wasm-tools and so on) although I can try upgrading it to latest version if needed

view this post on Zulip Wasmtime GitHub notifications bot (May 23 2024 at 15:13):

redoC-A2k edited a comment on issue #8687:

Could you explain more please ? If you can provide some documentations and demo github examples that will be great . I was expecting on guest side interrupt but I saw here - https://github.com/dicej/component-async-demo that @dicej has been using his local fork of wasmtime and other wasm tools (wit-bindgen , wasm-tools , wasmtime-wasi) . So I thought may be the async thing is not ready and not available right now . Also I am using right now 19 version of wasmtime and related tools (wasmtime-wasi , wasm-tools and so on) although I can try upgrading it to latest version if needed

view this post on Zulip Wasmtime GitHub notifications bot (May 23 2024 at 15:19):

dicej commented on issue #8687:

Implementing a cancellable timeout should be doable with WASI 0.2 using wasi:io/poll (i.e. you shouldn't need any of the WASI 0.3 stuff I'm currently working on, and that's not ready for production use yet anyway).

The main question to answer is: what event(s) should trigger cancellation? That will determine what kind of pollables you'll pass to the poll function in addition to the monotonic-clock.subscribe_duration pollable that represents the timeout. Should it be readability on a TCP socket? Progress on an outgoing HTTP request? Something else? All of the above?

view this post on Zulip Wasmtime GitHub notifications bot (Jun 17 2024 at 20:14):

alexcrichton closed issue #8687:

I want to wait / sleep or run a function after timeout of some seconds in wasm32-wasi component ? But I want that to be cancellable .
I tried doing this - https://stackoverflow.com/a/70121550 But I got error - failed to spawn thread: Error { kind: Unsupported, message: "operation not supported on this platform" } on spawning thread , I have tried compiling my rust to wasm32-wasip1-threads and on host I have make sure to enable wasm_threads support by config.wasm_threads(true).

What else do I need to do ?

view this post on Zulip Wasmtime GitHub notifications bot (Jun 17 2024 at 20:14):

alexcrichton commented on issue #8687:

I believe the question here has been answered so I'm going to close, but feel free to comment and/or open a new issue with other questions.


Last updated: Nov 22 2024 at 17:03 UTC