-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
wasi:apiIssues pertaining to the WASI API, not necessarily specific to Wasmtime.Issues pertaining to the WASI API, not necessarily specific to Wasmtime.
Description
Feature
Giving the following wasi-http design and implementation:
resource response-outparam {
set: static func(
param: response-outparam,
response: result<outgoing-response, error-code>,
);
}
fn set(
&mut self,
id: Resource<HostResponseOutparam>,
resp: Result<Resource<HostOutgoingResponse>, types::ErrorCode>,
) -> wasmtime::Result<()> {
let val = match resp {
Ok(resp) => Ok(self.table().delete(resp)?.try_into()?),
Err(e) => Err(e),
};
self.table()
.delete(id)?
.result
.send(val) <--- may fail the host call
.map_err(|_| anyhow::anyhow!("failed to initialize response"))
}
The common scenario is a host is waiting for a response from the guest under a given timeout. If the timeout is reached without having anything from the guest, the host will drop the receiver side of the channel, which will fail the hostcall and likely crash the wasi program.
Benefit
The error doesn't seem to be fatal, and the caller should be able to decide what to do next.
Implementation
Maybe allow the set API to return an error to the caller.
Metadata
Metadata
Assignees
Labels
wasi:apiIssues pertaining to the WASI API, not necessarily specific to Wasmtime.Issues pertaining to the WASI API, not necessarily specific to Wasmtime.