Magnet waiting for metadata can freeze the downloader
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
Start by reading internal/protocol/bt/fetcher.go around Resolve and pkg/download/downloader.go around the start handler, runPauseHandler, Continue, and pauseAll. Trace which locks are held while metadata resolution waits and how cancellation or pausing interacts with those locks. Done means a magnet waiting for metadata can be paused, and the described downloader operations do not remain blocked; add focused tests for those cases.
Written by the indexing model from the issue text.
Description
Description(required)
A magnet with no peers keeps Resolve waiting on GotInfo with no timeout (internal/protocol/bt/fetcher.go:844-851). The start handler holds task.lock across Resolve and Start (pkg/download/downloader.go:1999-2059), so:
Pauseon that task hangs, becauserunPauseHandlertakestask.lockfirst (:2148). BTPausewould also wait onf.mu, whichResolveholds.- When
MaxRunningis reached,Continueon another task pauses this one while holdingd.lock(:809-836).GetTasks,Create,Deleteand the progress loop then block too. CloserunspauseAllbeforefm.Close(:1236-1239), so quitting may hang as well. I found this by reading only.
With a fake fetcher whose Resolve blocks, GetTasks stayed blocked for over 1 s after Continue. In the BT fetcher, Pause stayed blocked for over 3 s while Resolve waited, and returned right after Close.
A possible fix is to let Pause cancel the metadata wait and to pause tasks in Continue after releasing d.lock. That changes lock ordering, so I'd like your view before sending a PR.
App Version(required)
main (b8ff5ff)
OS Version(required)
macOS 27 (not OS specific)
- 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