Skip to content

Conversation

@blushingpenguin
Copy link
Contributor

For review/test -- I have tried to fix the race conditions in pause/resume/cancel/restarting downloads here. The main thing that this does is to introduce two new states, pausing and cancelling which allow the download task (which is running on a background thread) to transition itself to the paused/cancelled state, and also locks the task while the state is being manipulated. I think that the idea is basically sound but there are probably some issues left.

@auouymous
Copy link
Member

Minor linting issue but it seems to fix #1117 and #1137.

It gets stuck forever when cancelling from failed or paused states.

#1147 is still an issue and blocks this PR from being merged.

@blushingpenguin
Copy link
Contributor Author

@auouymous I've fixed the lint issue and I've also fixed a (reintroduced) race when queuing multiple items -- if you had hit that when testing then cancel/pause/resume would have been broken (it wasn't hard to hit). I have also tried the test in #1147 (download from https://www.youtube.com/user/BBCRadio1VEVO, let it fail, enable youtube-dl and retry the download) which worked for me.

@blushingpenguin
Copy link
Contributor Author

Also there is (at least) one issue left here, if you restart a download that gets removed from the active downloads list then it is impossible to cancel/pause it. This can be done by starting two downloads (A+B), cancelling A, waiting for A to be cancelled, cancelling B, quickly right clicking on A, waiting for the downloads list to be cleared and then choosing A from the context menu for the vanished item. The task is no longer in the 'download_tasks_seen' list and this means that attempts to manipulate it fail, but it carries on in the background.

@auouymous
Copy link
Member

The cancelling issue is fixed but #1147 is not. Are you letting the download finish? It fails both ways for me, using Download with Youtube-DL on right click menu (easier to test), or checking manage_downloads in config and downloading.

@auouymous
Copy link
Member

#1152 is another issue.

@blushingpenguin
Copy link
Contributor Author

The cancelling issue is fixed but #1147 is not. Are you letting the download finish? It fails both ways for me, using Download with Youtube-DL on right click menu (easier to test), or checking manage_downloads in config and downloading.

Yes, I let it finish. I'm using https://www.youtube.com/user/BBCRadio1VEVO as the feed, then right clicking on
"Billie Eilish - I'm In The Mood For Love (Julie London Cover) in the Live Lounge" and choosing download, which fails, then right clicking again and choosing "Download with Youtube-DL" which succeeds. I am also able to play the downloaded video afterwards. I have tried some other episodes with the same result

@auouymous
Copy link
Member

My fault, #1044 is causing #1147. I don't know how it is working for you, or how it was working for me when I reverted the #1054 patch. The failed attempt deletes the empty partial file and the youtube-dl extension calls os.stat on it because the DownloadTask is only initialized before the first attempt, and the partial file is only created during initialization.

@auouymous auouymous merged commit 3d966b9 into gpodder:master Sep 8, 2021
snorkelopstesting2-coder pushed a commit to snorkel-marlin-repos/gpodder_gpodder_pr_1149_a48d4099-29af-4a57-b286-fc21a77fd61f that referenced this pull request Oct 22, 2025
snorkelopstesting1-a11y added a commit to snorkel-marlin-repos/gpodder_gpodder_pr_1149_a48d4099-29af-4a57-b286-fc21a77fd61f that referenced this pull request Oct 22, 2025
…g download tasks

Merged from original PR #1149
Original: gpodder/gpodder#1149
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants