-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix connect_timeout
for wasi-http
#8085
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix connect_timeout
for wasi-http
#8085
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, thank you!
assert!( | ||
matches!( | ||
res.unwrap_err().downcast_ref::<ErrorCode>(), | ||
Some(ErrorCode::ConnectionTimeout) | ||
), | ||
"expected connection timeout" | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for matching the timeout explicitly here!
I see two uses in the |
Thanks for the review!
There should be three (https://github.com/bytecodealliance/wasmtime/blob/eebce11eb1fdfc67ab8fc7a06cb68ba1231dd7a6/crates/wasi-http/src/types.rs). One is now newly added near the Why I mentioned it is because it sounded a bit weird to me that the |
Ah! Sorry for misunderstanding. I think this is fine to leave it this way, but I agree that it's a little odd. Reading through the handshake implementation, it's assuming that the connection has already been made, so if anything we might want to remove the timeout on the second two uses in the function. |
I added #8104 to record the fact that we should look into removing the uses of |
@elliottt in #7356 mentions that
connect_timeout
,first_byte_timeout
, andbetween_bytes_timeout
should be tested.This PR adds a test for
connect_timeout
and ensures thatTcpStream::connect
adheres to the timeout. Without this fix, settingconnect_timeout
has no effect on hosts whereTcpStream::connect
tries to connect.Note that the variable
connect_timeout
is also used a bit later for the handshake:wasmtime/crates/wasi-http/src/types.rs
Lines 207 to 213 in 8dd2ae9
I'm not sure whether using this variable twice is correct.