rust-lang / rustup

The Rust toolchain installer
https://rust-lang.github.io/rustup/
Apache License 2.0
6.1k stars 877 forks source link

Download speed becomes absurdly high for 6 seconds after resuming from a partial download #1166

Open kennytm opened 7 years ago

kennytm commented 7 years ago

Repro step:

  1. Download anything (e.g. rustup update, rustup add target, etc.)
  2. When download is partially complete (say 50%), Ctrl+C to kill it
  3. Resume download (run step 1 again).
  4. The download will start from 50%, and the speedometer extremely high, and the ETA being misleadingly short. The numbers will become normal after a few seconds.

Demo at https://asciinema.org/a/b5ayrzn7naj6td6qegq0xxyql. The speed should be around ~100 KiB/s, but at 00:59 where the download is resumed, the speed was reported to be ~1.0 MiB/s for 6 seconds, and suddenly goes back to ~100 KiB/s at 01:05.

It seems the speed calculation include the partially downloaded bytes, which it should not.

jelford commented 7 years ago

You're exactly right: the code that processes the previously downloaded part for checksumming purposes is hooked into the same notifier that keeps track of download progress. It shouldn't be too difficult to separate them out.

Out of interest, is this causing actual problems (apart from reporting obviously false information...)?

kennytm commented 7 years ago

@jelford No actual problem, just very annoying in estimating how much time I should pay attention to the progress.

kinnison commented 4 years ago

We've reworked the progress reporting code a few times since this issue was reported. Do you think it still needs further tweaking?