Skip to content

Commit 5005830

Browse files
authored
ignore Trap::AsyncDeadlock when running WASIp3 handlers (#3309)
That's a harmless error specific to Wasmtime 37, so no need to log it; we can remove the check once we've upgraded to Wasmtime 38. Signed-off-by: Joel Dice <[email protected]>
1 parent c60b74a commit 5005830

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

crates/trigger-http/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ terminal = { path = "../terminal" }
3636
tokio = { workspace = true, features = ["full"] }
3737
tokio-rustls = { workspace = true }
3838
tracing = { workspace = true }
39+
wasmtime = { workspace = true }
3940
wasmtime-wasi = { workspace = true }
4041
wasmtime-wasi-http = { workspace = true }
4142

crates/trigger-http/src/wasip3.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use std::{
1212
};
1313
use tokio::task;
1414
use tracing::{instrument, Instrument, Level};
15+
use wasmtime::Trap;
1516
use wasmtime_wasi_http::{
1617
body::HyperIncomingBody as Body,
1718
p3::{
@@ -84,7 +85,21 @@ impl HttpExecutor for Wasip3HttpExecutor<'_> {
8485
.in_current_span()
8586
.inspect(|result| {
8687
if let Err(error) = result {
87-
tracing::error!("Component error handling request: {error:?}");
88+
// TODO: Remove this check once we've updated to Wasmtime
89+
// 38+.
90+
//
91+
// Wasmtime 37's implementation of
92+
// `Instance::run_concurrent` returns `Trap::AsyncDeadlock`
93+
// if the `AsyncFnOnce` it was given does not resolve by the
94+
// time all outstanding tasks have finished. In this case,
95+
// it's harmless and we can ignore it. See
96+
// https://github.com/bytecodealliance/wasmtime/pull/11756
97+
// for details.
98+
if let Some(Trap::AsyncDeadlock) = error.downcast_ref::<Trap>() {
99+
// ignore
100+
} else {
101+
tracing::error!("Component error handling request: {error:?}");
102+
}
88103
}
89104
}),
90105
);

0 commit comments

Comments
 (0)