BT tasks: reported speed (and downloaded) inflated 10–40× for multi-file torrents (v2.0.0-beta.4)
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Read pkg/download/downloader.go and internal/protocol/bt/fetcher.go, then inspect how the BitTorrent library reports torrent-level transfer stats and verified completion. Reproduce with a healthy multi-file torrent and compare task API deltas with transfer stats. Done when reported speed and downloaded progress track verified torrent data without multi-file overcounting.
Written by the indexing model from the issue text.
Description
Version: v2.0.0-beta.4 (Docker, linux/amd64; same behaviour on beta.3)
Task type: BitTorrent magnet, multi-file torrent
What happens
The web UI / REST API shows a per-task download speed far above the real transfer rate, and the progress bar barely moves. Upload speed is also reported far above what the uplink can carry.
Measurements (same 2-minute window, polling the task API every 10 s)
- API
progress.speed: 115–335 MB/s - Δ
progress.downloaded/ Δt: 3–15 MB/s - Host NIC receive rate: ~9 MB/s
- In one 0.5 s sample
progress.downloadedjumped by +157 MB while the NIC carried ~9 MB/s, so thedownloadedcounter is also overstated tick-to-tick.
Likely cause
pkg/download/downloader.go computes delta = fetcher.Progress().TotalDownloaded() - Progress.Downloaded every RefreshInterval and derives speed from it. For BT, internal/protocol/bt/fetcher.go builds Progress() by summing file.BytesCompleted() per file. anacrolix File.BytesCompleted() includes dirty chunks of pieces that are not yet verified and counts pieces that span file boundaries in more than one file, so per-tick deltas are heavily overstated on multi-file torrents and can move backwards/forwards as pieces are verified.
Suggestion
Derive BT speed from torrent-level transfer stats (e.g. deltas of torrent.Stats().BytesReadUsefulData / DataBytesRead, and BytesWrittenData for upload), and report progress from verified bytes (torrent.BytesCompleted() at torrent level) rather than the per-file sum.
Steps to reproduce
- Add a magnet for a multi-file torrent with a healthy swarm.
- Compare the UI/API speed with the host's network receive rate, or with Δdownloaded over a 30 s window.
- Dominant language
- Dart
- Stars
- 27.7k
- Forks
- 1.8k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 26
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from GopeedLab/gopeed
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
GopeedLab/gopeed#1616 · 1 comment ·
Maintainers usually reply within 2 days
-
[Bug] Linux 点击创建任务后窗口不显示:setHasShadow 抛出 MissingPluginExceptionPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
GopeedLab/gopeed#1338 · 1 comment ·
Maintainers usually reply within 2 days
All issues in GopeedLab/gopeed
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Timer with tickCount stays finished after start() or reset()Possibly taken @matthewalberto claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
flame-engine/flame#4240 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
spotiflacapp/SpotiFLAC-Mobile#935 ·
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
chriskelly/wish-together#193 ·
Maintainers usually reply within 1 day
-
area: player feature request
Difficulty 2/5 1-3 hours Newbie friendliness 65/100