You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
wasi:http bleeding into the preview1 adapter #7266
We have seen this issue before @dicej@alexcrichton@pchickey, it appeared that it was fixed, but perhaps that was because the component and adapter definitions happened to be in sync during testing.
The Resolve for the world used to create the adapter has wasi:http in it. This is because the wasmtime:wasi package that's used to pull everything together has worlds in it that depend on wasi:http.
When the adapter is produced the wasmtime:wasi package is serialized into binary and embedded within the adapter itself.
When the adapter is processed by wit-component it will deserialize this information into an entire Resolve and then merge it with the target resolve.
This means that even though the adapter itself doesn't use the wasi:http interfaces the merge step of two Resolve items still attempts to merge them together. The best fix that I can think of is to filter out items during the encoding phase so only the relevant types are encoded, namely just the wasmtime:wasi/preview1-adapter-reactor world for example. Such filtering should remove the encoding of wasi:http types and interfaces, meaning they'll be entirely gone from the adapter.
Such a change must happen in wit-component in the wasm-tools repository. I'll wait for bytecodealliance/wasm-tools#1252 to finish before implementing this.
Ok I've looked again at this and this should be solved by bytecodealliance/wasm-tools#1260. The issue doesn't actually reproduce as-is today due to the introduction of versions on main which means merging now succeeds, but I've tested main just before versions came in and was able to reproduce this issue and test that bytecodealliance/wasm-tools#1260 fixes things.
The fix there will be a bit delayed due to the fact that we'll have it off-by-default for a bit. Eventually down the road we'll switch the adapter to using the new metadata format by default, but until that point this bug will still be present. You can compile your own adapter, however, and specify WIT_COMPONENT_NEW_ENCODE=1 to build an adapter with the new format to fix this issue. This does depend on all pices of the system using an updated wit-component, however.
Activity
[-]`wasi:http` bleeding into the preview2 adapter[/-][+]`wasi:http` bleeding into the preview1 adapter[/+]alexcrichton commentedon Oct 17, 2023
Looking into this the issue appears to be:
Resolvefor the world used to create the adapter haswasi:httpin it. This is because thewasmtime:wasipackage that's used to pull everything together has worlds in it that depend onwasi:http.wasmtime:wasipackage is serialized into binary and embedded within the adapter itself.wit-componentit will deserialize this information into an entireResolveand then merge it with the target resolve.This means that even though the adapter itself doesn't use the
wasi:httpinterfaces the merge step of twoResolveitems still attempts to merge them together. The best fix that I can think of is to filter out items during the encoding phase so only the relevant types are encoded, namely just thewasmtime:wasi/preview1-adapter-reactorworld for example. Such filtering should remove the encoding ofwasi:httptypes and interfaces, meaning they'll be entirely gone from the adapter.Such a change must happen in
wit-componentin thewasm-toolsrepository. I'll wait for bytecodealliance/wasm-tools#1252 to finish before implementing this.Minimize bindgen type information
alexcrichton commentedon Oct 20, 2023
Ok I've looked again at this and this should be solved by bytecodealliance/wasm-tools#1260. The issue doesn't actually reproduce as-is today due to the introduction of versions on
mainwhich means merging now succeeds, but I've testedmainjust before versions came in and was able to reproduce this issue and test that bytecodealliance/wasm-tools#1260 fixes things.The fix there will be a bit delayed due to the fact that we'll have it off-by-default for a bit. Eventually down the road we'll switch the adapter to using the new metadata format by default, but until that point this bug will still be present. You can compile your own adapter, however, and specify
WIT_COMPONENT_NEW_ENCODE=1to build an adapter with the new format to fix this issue. This does depend on all pices of the system using an updatedwit-component, however.Minimize bindgen type information (#1260)
alexcrichton commentedon Mar 26, 2024
I believe this has since been fixed, so closing.