http-rs / http-rs/surf

`Response::body_bytes` does not timeout properly

Open
#359 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.5k
Forks
128
PR merge metrics
No merged PRs in 30d

Description

Awaiting on [`Response::body_bytes`](https://docs.rs/surf/latest/surf/struct.Response.html#method.body_bytes) may not return properly, even when timeout is set with [set_timeout](https://docs.rs/surf/latest/surf/struct.Config.html#method.set_timeout).

[Relevant log file](https://pastebin.com/YyUtz7Df)

This log was generated from https://github.com/riveroon/twitch-archive/tree/debug_hls with a custom future which logs every `poll()` requests.
The main, media, client, and body in the logs are [here](https://github.com/riveroon/twitch-archive/blob/debug_hls/src/hls.rs#L217), [here](https://github.com/riveroon/twitch-archive/blob/debug_hls/src/hls.rs#L168), [here](https://github.com/riveroon/twitch-archive/blob/debug_hls/src/hls.rs#L53) and [here](https://github.com/riveroon/twitch-archive/blob/debug_hls/src/hls.rs#L122), respectively.
(I know this seems stupid - but I wanted to know if body_bytes was blocking inside a call, or simply not calling Waker.)

Enabled features are: `surf = { version = "2", default_features = false, features = ["h1-client-rustls", "encoding"] }`

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the timeout behavior described for Response::body_bytes with the linked twitch-archive debug_hls setup and review the linked poll log. Trace the requests and waker activity around body_bytes and set_timeout; done means awaiting body_bytes returns when the configured timeout expires.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.