Stream: wasi

Topic: ✔ Trampoline::{Future,Stream}{Read,Write} canon opts


view this post on Zulip Victor Adossi (Sep 03 2025 at 17:33):

Hey all, quick question -- it seems like wasmtime_environ::Trampoline::StreamWrite and friends have async_ set in theircanon opts (via the options: OptionsIndex member).

I'm pulling the opts like this:

                let options = self
                    .component // &wasmtime_environ::Component
                    .options
                    .get(*options)
                    .expect("failed to find options");

When I get the CanonicalOptions object out, it's got async_ set and no callback (which is invalid)

Intuitively, the canon functions are clearly not async, so I'm thinking the issue here is that async_ is set on the CanonicalOptions that got created?

Alternatively, if I read this line in the canonopt validation section a bit differently:

Maybe the intent was that it's fine for async_ to be set, but callback can be missing (and I should basically only check that non-async things don't have a callback, not that all async things must have a callback).

Obviously during canon_lift the callback is quite required, but the canon function is a little blurrier...

I'm leaning towards the idea that the CanonicalOptions being set/saved for the relevant Trampoline:: members should not have async_ set in the first place.

Repository for design and specification of the Component Model - WebAssembly/component-model

view this post on Zulip Alex Crichton (Sep 03 2025 at 17:39):

ah yeah this is where each option is a bit overloaded in the context of each intrinsic

view this post on Zulip Alex Crichton (Sep 03 2025 at 17:40):

but async_ means whether these intrinsics are blocking or not basically for stream/future read/write

view this post on Zulip Alex Crichton (Sep 03 2025 at 17:40):

and the validation is different from canon lift'd functions for now (in the future though we might allow just-async_ on functions)

view this post on Zulip Victor Adossi (Sep 03 2025 at 17:40):

Ah OK, I thought that might be the case -- that somehow async_ meant something different in this context

view this post on Zulip Victor Adossi (Sep 03 2025 at 17:41):

OK, great, I've got that implemented -- I just disabled that last check for stream.write/etc and kept all the other ones on

view this post on Zulip Alex Crichton (Sep 03 2025 at 17:41):

FWIW you can skip all the validation bits in jco b/c wasmparser/wasmtime-environ do all that for you

view this post on Zulip Victor Adossi (Sep 03 2025 at 17:42):

Even better, I'll do that!

view this post on Zulip Victor Adossi (Sep 03 2025 at 17:44):

Thanks for the help! I think this makes sense now

view this post on Zulip Notification Bot (Sep 03 2025 at 17:44):

Victor Adossi has marked this topic as resolved.


Last updated: Dec 06 2025 at 06:05 UTC