We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Version
tokio-hang v0.1.0 (/data/surban/dev/rust-wasi-web/tokio-hang) └── tokio v1.42.0 (/data/surban/dev/tokio/tokio) └── tokio-macros v2.4.0 (proc-macro) (/data/surban/dev/tokio/tokio-macros)
Platform wasm32-wasip1 and wasm32-wasip1-threads using wasmtime executor or wasmer
wasm32-wasip1
wasm32-wasip1-threads
Description Using the timeout function makes the following program hang on wasm32-wasip1. The program works fine either on
timeout
x86_64-unknown-linux-gnu
I tried this code:
Available at https://github.com/surban/tokio-hang
use std::time::Duration; use futures::{SinkExt, StreamExt}; use tokio::time::timeout; async fn send_task(mut tx: futures::channel::mpsc::Sender<u8>) { println!("feeding 0"); tx.feed(0).await.unwrap(); println!("flushing 0"); tx.flush().await.unwrap(); println!("feeding 1"); tx.feed(1).await.unwrap(); println!("flushing 1"); tx.flush().await.unwrap(); } async fn recv_task(mut rx: futures::channel::mpsc::Receiver<u8>) { loop { println!("waiting to receive"); match rx.next().await { Some(msg) => println!("received: {msg}"), None => break, } } println!("end of receive"); } #[tokio::main(flavor = "current_thread")] async fn main() { let qlen = 0; let (a_tx, b_rx) = futures::channel::mpsc::channel::<u8>(qlen); let task = async move { tokio::join!(send_task(a_tx), recv_task(b_rx)) }; timeout(Duration::from_secs(60), task).await.unwrap(); // works without timeout: // task.await; }
I expected to see the following output (it works on x86_64-unknown-linux-gnu):
feeding 0 flushing 0 waiting to receive received: 0 waiting to receive feeding 1 flushing 1 received: 1 waiting to receive end of receive
Instead, this happened on wasm32-wasip1:
feeding 0 flushing 0 waiting to receive received: 0 waiting to receive
Then it hangs.
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Version
Platform
wasm32-wasip1
andwasm32-wasip1-threads
using wasmtime executor or wasmer
Description
Using the
timeout
function makes the following program hang onwasm32-wasip1
.The program works fine either on
x86_64-unknown-linux-gnu
wasm32-wasip1
without thetimeout
wrapperI tried this code:
Available at https://github.com/surban/tokio-hang
I expected to see the following output (it works on
x86_64-unknown-linux-gnu
):Instead, this happened on
wasm32-wasip1
:Then it hangs.
The text was updated successfully, but these errors were encountered: