theupdateframework / theupdateframework/rust-tuf

SafeReader doesn't detect stalled transfers

Open
#272 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
198
Forks
39
Avg merge
9h 19m
Merged PRs (30d)
2

Description

If min_bytes_per_second is non-zero and a transfer is making forward progress but more slowly than required, the stream should error out as expected, however, as poll_read is only expected to be called when more data is available (or the future has otherwise been woken up), if a transfer stalls out completely, nothing will currently wake up the reader for it to detect the stall and produce an error.

It looks like it will need to setup a timer on every call to poll_read that is associated with the Context, but I don't think there is an async cross platform timer crate we could use here yet.

There is also the larger topic of how to test this type without having tests that run longer than 30 seconds (the minimum amount of time before SafeReader enforces a minimum transfer rate) that would be useful to solve too.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at SafeReader's poll_read implementation and inspect how its Context and wakeups currently govern stalled transfers. Determine how a cross-platform timer could trigger stalled-rate detection, then design tests that exercise the timeout without waiting over 30 seconds. Done means a completely stalled transfer produces the expected error and the behavior is covered by practical tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.