Stream: git-wasmtime

Topic: wasmtime / PR #11763 support continuing host-to-host stre...


view this post on Zulip Wasmtime GitHub notifications bot (Sep 30 2025 at 15:11):

dicej requested alexcrichton for a review on PR #11763.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 30 2025 at 15:11):

dicej opened PR #11763 from dicej:fix-11703 to bytecodealliance:main:

This addresses #11703 by allowing the embedder to "short-circuit" host-to-host streams and keep them flowing after the guest instance and its store have been disposed. Besides fixing that bug, it makes common proxy and full-duplex streaming scenarios more efficient by getting the Wasmtime runtime out of the way as early as possible, avoiding the extra memory and indirection overhead which would otherwise be imposed.

See the individual commit messages for details. Here's a summary:

Note that the implementation of StreamReader::try_into required adding a default-implemented StreamProducer::try_into function for doing the coercion. The signature of that function is a bit awkward given that we have to erase the types and do runtime downcasts internally. The upside is that it supports the scenario where the StreamProducer implementation is !Unpin (meaning it cannot be downcasted, AFAICT), in which case it may be coerced into a type representing a relevant subset which is Unpin.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Sep 30 2025 at 15:11):

dicej requested wasmtime-wasi-reviewers for a review on PR #11763.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 30 2025 at 15:11):

dicej requested wasmtime-core-reviewers for a review on PR #11763.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 30 2025 at 15:11):

dicej requested wasmtime-default-reviewers for a review on PR #11763.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 30 2025 at 15:23):

dicej commented on PR #11763:

@rvolosatovs you might have opinions about https://github.com/bytecodealliance/wasmtime/pull/11763/commits/30afd9fa9e2a7adbf768c476a6119851e229ff5b

view this post on Zulip Wasmtime GitHub notifications bot (Sep 30 2025 at 19:41):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 30 2025 at 19:41):

alexcrichton created PR review comment:

This Box::new(*...) shouldn't be necessary I think? In theory Pin::into_inner(me) should suffice here I believe

view this post on Zulip Wasmtime GitHub notifications bot (Sep 30 2025 at 19:41):

alexcrichton created PR review comment:

Could this happen during the construction of Response instead of here? Then I believe this would naturally fall through to Body::Host below?

view this post on Zulip Wasmtime GitHub notifications bot (Sep 30 2025 at 19:48):

dicej submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 30 2025 at 19:48):

dicej created PR review comment:

The compiler doesn't like that:

error[E0277]: `dyn std::any::Any` cannot be unpinned
   --> crates/wasi-http/src/p3/body.rs:543:32
    |
543 |             Ok(Pin::into_inner(me))
    |                --------------- ^^ the trait `std::marker::Unpin` is not implemented for `dyn std::any::Any`
    |                |
    |                required by a bound introduced by this call

view this post on Zulip Wasmtime GitHub notifications bot (Sep 30 2025 at 19:54):

alexcrichton created PR review comment:

Weird! let me = Pin::into_inner(me); Ok(me) works though.

I think it's because it's trying to coerce me: Pin<Box<Self>> into Pin<Box<dyn Any>> and then go through Pin::into_inner to get out the Box<dyn Any> which doesn't work because dyn Any indeed does not implement Unpin. By separating it out it guides inference correctly.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 30 2025 at 19:54):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 30 2025 at 20:02):

dicej updated PR #11763.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 30 2025 at 20:02):

dicej submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 30 2025 at 20:02):

dicej created PR review comment:

Good idea; done!

view this post on Zulip Wasmtime GitHub notifications bot (Sep 30 2025 at 20:04):

dicej has enabled auto merge for PR #11763.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 30 2025 at 20:38):

dicej merged PR #11763.


Last updated: Dec 06 2025 at 07:03 UTC