Skip to content

stream.segmented: fix wait() in writer thread-pool #5236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

bastimeyer
Copy link
Member

@bastimeyer bastimeyer commented Mar 10, 2023

The SegmentedStreamWriter's _wait event needs to be set before awaiting the shutdown of the thread-pool executor, otherwise the threads of the executor won't ever receive this signal. For example, queued segment downloads can't be cancelled because the event never gets set before awaiting the shutdown of the executor, so wait() calls in the executor's threads time out regularly and return True.


Fixes queued DASH segments being downloaded after closing the stream.

The `SegmentedStreamWriter`'s `_wait` event needs to be set before
awaiting the shutdown of the thread-pool executor, otherwise the threads
of the executor won't ever receive this signal. For example, queued
segment downloads can't be cancelled because the event never gets set
before awaiting the shutdown of the executor, so `wait()` calls in the
executor's threads time out regularly and return `True`.
@gravyboat gravyboat merged commit f234c69 into streamlink:master Mar 11, 2023
@bastimeyer bastimeyer deleted the stream/segmented/fix-wait-in-writer-thread-pool branch March 11, 2023 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants