Skip to content

Pass transmission errors to the future from {request, response}.new - #14148

Open
adamrk wants to merge 5 commits into
bytecodealliance:mainfrom
adamrk:request-new-future-fail
Open

Pass transmission errors to the future from {request, response}.new#14148
adamrk wants to merge 5 commits into
bytecodealliance:mainfrom
adamrk:request-new-future-fail

Conversation

@adamrk

@adamrk adamrk commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Addresses #14112.

Instead of adding a new test, we modify existing tests which were just checking the response error to now check the transmission error.

As a drive by change, this also removes BodyWithState which seems to be unused.

@adamrk
adamrk requested review from a team as code owners August 17, 2026 18:21
@adamrk
adamrk requested review from pchickey and removed request for a team August 17, 2026 18:21
@adamrk

adamrk commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Current CI error seems to be Github's fault, but I don't have permissions to retry it.

@pchickey

Copy link
Copy Markdown
Contributor

I kicked it. LGTM but I'd like @dicej to take a look if he has a moment, he might spot subtle stuff related to these futures that aren't apparent to me.

@pchickey
pchickey requested review from dicej and removed request for pchickey August 17, 2026 23:44

@dicej dicej left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @adamrk!

Comment thread crates/wasi-http/src/p3/host/handler.rs Outdated
@@ -61,7 +87,7 @@ impl<T> HostWithStore<T> for WasiHttp {
let (req, options) =
req.into_http_with_getter(&mut store, io_task_result(io_result_rx), getter)?;
HttpResult::Ok(store.get().hooks.send_request(
req.map(|body| body.with_state(io_task_rx).boxed_unsync()),
req.map(|body| body.boxed_unsync()),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this map call still serving any purpose? Can we remove it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, it's not needed anymore.

Comment thread crates/wasi-http/src/p3/host/handler.rs Outdated
io_result_rx.await.unwrap_or(Ok(()))
io_result_rx.await.unwrap_or_else(|_| {
Err(Error::InternalError(Some(
"Future indicating transmission result dropped without being resolved.".to_string(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: consider moving the string literal into a named constant to avoid the duplication.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread crates/wasi-http/src/p3/host/handler.rs Outdated
body.with_state(io).boxed_unsync()
}));
_ = io_result_tx.send((Some(io), rx));
body.boxed_unsync()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the boxed_unsync call still serving a purpose here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one could also be removed.

@adamrk
adamrk requested a review from dicej August 18, 2026 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants