Repository navigation
Conversation
The worker loop ignored TryRecvError::Disconnected on the control channel, so each dropped DfPlugin left a detached thread polling its input queue forever. Hosts that re-instantiate the plugin often (e.g. PipeWire filter-chain on every graph quantum change) accumulate hundreds of busy threads over time. Break out of the loop once the control sender is gone. Fixes Rikorose#711
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #711.
Problem
get_worker_fnhandles the control channel withif let Ok(..) = controls.try_recv(), so it never noticesTryRecvError::Disconnected. When the host drops aDfPlugin(LADSPAcleanup),control_txis dropped but the detached worker thread keeps polling its input queue and sleeping forever.This matters in practice with PipeWire's
filter-chain, which re-instantiates the plugin whenever the graph quantum changes, i.e. every time an app starts or stops playback. On my desktop acall-micfilter-chain runningdeep_filter_monohad accumulated about 710 threads after 7 days of uptime, using about 110% CPU, and the live instance logged constantUnderrun detected ... Processing too slow!.Fix
Match on
try_recv()and break out of the worker loop onDisconnected. This is a behavioural no-op while the plugin is alive.Testing
PipeWire 1.6.10,
deep_filter_mono(defaultDeepFilterNet3_llmodel) in a filter-chain at 48 kHz:pw-metadata -n settings 0 clock.force-quantum <512|1024|256>left one more thread in the host process (5 → 6 → 7 → 8).