If the connection fails, a new connection is triggered from context_state_callback(pa_context *c, void *) using QTimer::singleShot(50, s_mixers[KMIXPA_PLAYBACK], SLOT(reinit())); Depending on how long it takes from starting the connection attempt to PA_CONTEXT_FAILED, up to 20 connection attempts are made per second. A exponential backoff with a limit of 10s would be better here. Reproducible: Always
This happens if PULSE_SERVER is set to a remote location and the remote is currently not available. pa_context_connect returns 0 in this case, and the state callback is called with pa_state == FAILED.
We have received a patch for this issue in the Debian bugtracker in the bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=789887 which still seems to apply. Index: kmix-4.14.0/backends/mixer_pulse.cpp =================================================================== --- kmix-4.14.0.orig/backends/mixer_pulse.cpp +++ kmix-4.14.0/backends/mixer_pulse.cpp @@ -37,6 +37,8 @@ # include <canberra.h> #endif +#include <time.h> + // PA_VOLUME_UI_MAX landed in pulseaudio-0.9.23, so this can be removed when/if // minimum requirement is ever bumped up (from 0.9.12 currently) #ifndef PA_VOLUME_UI_MAX @@ -716,7 +718,14 @@ static void context_state_callback(pa_co if (s_mixers.contains(KMIXPA_PLAYBACK)) { kWarning(67100) << "Connection to PulseAudio daemon closed. Attempting reconnection."; s_pulseActive = UNKNOWN; - QTimer::singleShot(50, s_mixers[KMIXPA_PLAYBACK], SLOT(reinit())); + static time_t last_timestamp = 0; + time_t current_time = time(NULL); + if ((current_time - last_timestamp) > 3) { + QTimer::singleShot(50, s_mixers[KMIXPA_PLAYBACK], SLOT(reinit())); + } else { + QTimer::singleShot(60000, s_mixers[KMIXPA_PLAYBACK], SLOT(reinit())); + } + last_timestamp = current_time; } } }
Created attachment 101774 [details] Patch as posted in the Debian bugtracker
Thank you for reporting this bug in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version? If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Dear Bug Submitter, This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information as soon as possible and set the bug status as REPORTED. Due to regular bug tracker maintenance, if the bug is still in NEEDSINFO status with no change in 30 days the bug will be closed as RESOLVED > WORKSFORME due to lack of needed information. For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging If you have already provided the requested information, please mark the bug as REPORTED so that the KDE team knows that the bug is ready to be confirmed. Thank you for helping us make KDE software even better for everyone!
This bug has been in NEEDSINFO status with no change for at least 30 days. The bug is now closed as RESOLVED > WORKSFORME due to lack of needed information. For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging Thank you for helping us make KDE software even better for everyone!