From ac7a128fc4cb55631cc0349ee11166ad2daa2c83 Mon Sep 17 00:00:00 2001 From: csh <458761603@qq.com> Date: Mon, 29 Jul 2024 16:06:43 +0800 Subject: [PATCH 1/2] [Optimize] Avoid poll writeable hang forever Signed-off-by: csh <458761603@qq.com> --- crates/async-wasi/src/snapshots/common/net/async_tokio.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/async-wasi/src/snapshots/common/net/async_tokio.rs b/crates/async-wasi/src/snapshots/common/net/async_tokio.rs index 4f0304f58..09355c220 100644 --- a/crates/async-wasi/src/snapshots/common/net/async_tokio.rs +++ b/crates/async-wasi/src/snapshots/common/net/async_tokio.rs @@ -154,16 +154,16 @@ pub(crate) struct SocketWritable(pub(crate) AtomicI8); impl SocketWritable { pub(crate) async fn writable(&self) { let b = self.0.fetch_sub(1, std::sync::atomic::Ordering::Acquire); - SocketWritableFuture(b).await; + tokio::time::timeout(Duration::from_secs(10), SocketWritableFuture(b)).await; } pub(crate) fn set_writable(&self) { - self.0.store(2, std::sync::atomic::Ordering::Release) + self.0.store(5, std::sync::atomic::Ordering::Release) } } impl Default for SocketWritable { fn default() -> Self { - Self(AtomicI8::new(2)) + Self(AtomicI8::new(5)) } } From dc373f79a99e3dd993b2791c772dac9e92485f2f Mon Sep 17 00:00:00 2001 From: csh <458761603@qq.com> Date: Mon, 29 Jul 2024 16:07:44 +0800 Subject: [PATCH 2/2] [Bump] `async-wasi` to `0.2.1` Signed-off-by: csh <458761603@qq.com> --- crates/async-wasi/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/async-wasi/Cargo.toml b/crates/async-wasi/Cargo.toml index 57ee21ec4..03ae67529 100644 --- a/crates/async-wasi/Cargo.toml +++ b/crates/async-wasi/Cargo.toml @@ -7,7 +7,7 @@ license = "Apache-2.0" name = "async-wasi" readme = "README.md" repository = "https://github.com/WasmEdge/wasmedge-rust-sdk" -version = "0.2.0" +version = "0.2.1" [dependencies] log = "0.4"