diff --git a/crates/trigger-http/Cargo.toml b/crates/trigger-http/Cargo.toml index 40fe090b23..62637df8d3 100644 --- a/crates/trigger-http/Cargo.toml +++ b/crates/trigger-http/Cargo.toml @@ -36,6 +36,7 @@ terminal = { path = "../terminal" } tokio = { workspace = true, features = ["full"] } tokio-rustls = { workspace = true } tracing = { workspace = true } +wasmtime = { workspace = true } wasmtime-wasi = { workspace = true } wasmtime-wasi-http = { workspace = true } diff --git a/crates/trigger-http/src/wasip3.rs b/crates/trigger-http/src/wasip3.rs index 9c8aa5c347..416b61ca55 100644 --- a/crates/trigger-http/src/wasip3.rs +++ b/crates/trigger-http/src/wasip3.rs @@ -12,6 +12,7 @@ use std::{ }; use tokio::task; use tracing::{instrument, Instrument, Level}; +use wasmtime::Trap; use wasmtime_wasi_http::{ body::HyperIncomingBody as Body, p3::{ @@ -84,7 +85,21 @@ impl HttpExecutor for Wasip3HttpExecutor<'_> { .in_current_span() .inspect(|result| { if let Err(error) = result { - tracing::error!("Component error handling request: {error:?}"); + // TODO: Remove this check once we've updated to Wasmtime + // 38+. + // + // Wasmtime 37's implementation of + // `Instance::run_concurrent` returns `Trap::AsyncDeadlock` + // if the `AsyncFnOnce` it was given does not resolve by the + // time all outstanding tasks have finished. In this case, + // it's harmless and we can ignore it. See + // https://github.com/bytecodealliance/wasmtime/pull/11756 + // for details. + if let Some(Trap::AsyncDeadlock) = error.downcast_ref::() { + // ignore + } else { + tracing::error!("Component error handling request: {error:?}"); + } } }), );