-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
wasm-proposal:component-model-asyncIssues related to the WebAssembly Component Model async proposalIssues related to the WebAssembly Component Model async proposal
Description
Currently in Wasmtime with component-model-async when a host function is cancelled the future representing that host function is simply dropped. I believe that the future gets a single final poll to produce a result before being dropped, but fundamentally Wasmtime doesn't provide embedders a means by which to gracefully handle the cancellation signal. This means that it's not easy or possible to impelement a sort of "atomic cancellation" in Wasmtime today where upon receiving cancellation some operation may already be complete but it is unable to communicate that. This is inspired by discussion here w.r.t cancelling UDP send operations.
Some possible shapes of a solution here are:
- Instead of returning a return value, hosts could be provided an object through which the return value is transmitted. This models
task.returnmore closely and bindings generation could paper over the differences here. This would enable hosts to at least provide a return value in aDropimplementation. - Hosts could be provided a sort of
CancellationTokenwhich has helper methods/etc to test/await it. Wasmtime would then not actually drop the future at all, but it would instead set theCancellationTokenand continue polling as usual. It'd be up to embedders to drop futures, for example.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
wasm-proposal:component-model-asyncIssues related to the WebAssembly Component Model async proposalIssues related to the WebAssembly Component Model async proposal
Type
Projects
Status
After-P3