-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
awaits (in host functions) are getting stuck in Async wasmtime #2876
Comments
You are using a tokio timer, but futures exector (block_on). This is not allowed. Tokio requires you to use tokio's executor. As you are using |
@venugopv I believe @bjorn3 is correct regarding the need to use tokio's executor in your repro ( As such I'm closing this issue. Please reopen if you think there's something Wasmtime needs to fix or if @bjorn3's suggestion doesn't help you. Thank you! |
see also: #2832, which includes an example of using wasmtime on tokio. |
@bjorn3 @peterhuene Thanks for your quick response. We are trying to refactor our code to remove block_on and model based on tokio example #2832. |
I searched for 128 in the tokio source. I found the following thing that could be the origin: https://github.com/tokio-rs/tokio/blob/b42f21ec3e212ace25331d0c13889a45769e6006/tokio/src/coop.rs#L55 |
There's also some additional context in rust-lang/futures-rs#2157 that seems related to hitting this coop limit when using a tokio timer without yielding back to the tokio executor. |
In async wasmtime (using tokio runtime)+block_on usage: awaits from host functions are getting stuck. First instances of await are working fine. After few instances, await is getting stuck without returning any thing.
In the following test case, the first 128 awaits are returned properly, and the next await got stuck infinitely.
We are using block_on to complete futures for instantiate_async and call_async. Without block_on, all awaits are getting executed normal.
Test Case
Steps to Reproduce
run the above code. Host function get stuck after sleep instances, waiting infinity on await.
We have used cargo to run i.e 'cargo run'
Expected Results
Even with block_on usage, awaits should work normally.
Actual Results
Awaits are getting stuck with block_on usage.
Versions and Environment
Wasmtime version or commit: 0.26
Operating system: Mac
Architecture: x86_64
Extra Info
The text was updated successfully, but these errors were encountered: