Stream: wasi

Topic: `wit-component` fails to encode `write-via-stream`


view this post on Zulip Roman Volosatovs (Mar 30 2023 at 13:16):

Hi, I originally posted this in https://bytecodealliance.zulipchat.com/#narrow/stream/356481-wasi-cloud/topic/Runtime.20panic.20building.20a.20component.20utilizing.20.60wasi-http.60, but after further inspection it seems that this stream may be a better fit, in fact.

I'm trying to build a component exporting wasi-http incoming-handler, any mention of that interface in the world causes a runtime panic in wit-component. On further inspection I see that it fails to encode write-via-stream.
Note, that building a component only using other interfaces, e.g. random or logging works just fine. I am currently trying to trim down the interface to see what exactly is causing this import encoding and failure to do so.

Meanwhile, maybe someone has an idea about what could be wrong?

view this post on Zulip Roman Volosatovs (Mar 30 2023 at 13:17):

Issue: https://github.com/bytecodealliance/wasm-tools/issues/967
Repro: https://github.com/rvolosatovs/wasi-http-guest-repro

WebAssembly components currently cannot utilize https://github.com/WebAssembly/wasi-http on commit 53e2d258ae3008d254bda79ec958355ded8751a9 with: wit-bingen 0.4.0 wit-component 0.7.4 wasi_snapshot_...
Contribute to rvolosatovs/wasi-http-guest-repro development by creating an account on GitHub.

view this post on Zulip Roman Volosatovs (Mar 30 2023 at 13:29):

Ok, that turned out to be simpler than I thought:

default interface streams {}

default world guest {
    import streams: self.streams
}

This is an example causing a panic

view this post on Zulip Roman Volosatovs (Mar 30 2023 at 14:08):

Filed a PR with a (temporary) fix https://github.com/WebAssembly/wasi-http/pull/21

Unfortunately, naming the interface dependency streams causes a clash with wasi_snapshot_preview1.wasm streams causing a runtime panic in wit-component. While the fix for this issue clearly belongs...

view this post on Zulip Peter Huene (Mar 30 2023 at 17:44):

@Roman Volosatovs thanks for filing the wasm-tools issue; hopefully we can implement a fix for it soon. I think the best thing to do here is, rather than modifying anything in WASI preview2 to work around it, don't mix a preview2 adapter with a component that also directly uses preview2 in its world (or any conflicting names...). i know that's pretty inconvenient, but it should work around the issue in wit-component until a proper fix can be made


Last updated: Oct 23 2024 at 20:03 UTC