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
support continuing host-to-host streams after store is dropped (#11763)
* add `StreamReader::try_into` and use it in `Response::into_http_with_getter`
This allows the embedder to consume a host-created `StreamReader` and extract
the `StreamProducer` (or an `Unpin` subset of it) used to create it. This
enables "short-circuiting" host-to-host streams, bypassing the guest entirely.
Concretely, it is now possible to dispose of a `wasi:http/[email protected]` guest
and its store before the request and/or response bodies have finished streaming
in the case where both the read and write ends of the body stream are owned by
the host. In this case, the inbound body is reused as the outbound body with no
additional processing or memory overhead.
Signed-off-by: Joel Dice <[email protected]>
* spawn tokio task instead of store task for outbound requests
Previously, `wasmtime-wasi-http`'s outbound request handler used
`Accessor::spawn` to spawn the connection future for a given outbound request,
but that meant the request stopped making progress when the store was dropped.
That's a problem for a proxy scenario where the guest task just wants to make an
outgoing request and return the response (or at least the body of that response)
and then exit. At that point, we should be able to drop the instance and its
store and expect the body stream will continue to flow. Using
`tokio::task::spawn` ensures that will happen.
Fixes#11703
Signed-off-by: Joel Dice <[email protected]>
* test host-to-host streaming in wasi-http p3 tests
In the process of adding these tests, I found that we were leaking subtasks
which had exited but not been dropped by their supertask by the time that
supertask was dropped, so I've fixed that.
Signed-off-by: Joel Dice <[email protected]>
* address review feedback
Signed-off-by: Joel Dice <[email protected]>
---------
Signed-off-by: Joel Dice <[email protected]>
0 commit comments