Bug 284176 - knotify4 v pulseaudio startup race
Summary: knotify4 v pulseaudio startup race
Status: CONFIRMED
Alias: None
Product: Phonon
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 4.6.0
Platform: Ubuntu Linux
: NOR normal
Target Milestone: 4.5.1
Assignee: Harald Sitter
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-16 12:09 UTC by Dave Gilbert
Modified: 2021-03-10 07:18 UTC (History)
8 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Gilbert 2011-10-16 12:09:46 UTC
Version:           unspecified (using KDE 4.7.2) 
OS:                Linux

(I originally reported this on Ubuntu's Launchpad as:
https://bugs.launchpad.net/ubuntu/+source/kde-runtime/+bug/875660)

I'm running Kubuntu with pulseaudio.
I have on my motherboard intel hda analog audio and my graphics card (an ATI) had an HDMI out; by default I like the audio to come out of the analog output that is the only one connected.

Sometimes logging into KDE I find that it's decided to switch to the HDMI as the default; today I caught it and did an lsof /dev/snd/* and found:

knotify4 2276 dg mem CHR 116,3 6691 /dev/snd/pcmC0D0p
knotify4 2276 dg 20r CHR 116,33 0t0 9995 /dev/snd/timer
knotify4 2276 dg 21u CHR 116,3 0t0 6691 /dev/snd/pcmC0D0p
pulseaudi 2893 dg 24u CHR 116,9 0t0 6698 /dev/snd/controlC1
pulseaudi 2893 dg 31u CHR 116,6 0t0 6694 /dev/snd/controlC0
pulseaudi 2893 dg 38u CHR 116,6 0t0 6694 /dev/snd/controlC0

So knotify4 has hogged the analog output, and hence pa can't get in.

So I kill knotify4, and do a pactl exit to restart pa - but pa then still lists the HDMI as the default output in paman.

(I've now found I can switch it back with pacmd set-default-sink)

Dave

Reproducible: Sometimes

Steps to Reproduce:
It's a race, so only happens sometimes.
1) Login
2) Try to play some music
3) Find it doesn't play
4) lsof /dev/snd/* to see who has what devices

Actual Results:  
No music coming out of my analog output.
lsof shows knotify4 hogging the analog device

Expected Results:  
Sweet music on my analog output, pa has opened all the devices.
Comment 1 Colin Guthrie 2011-10-17 09:47:52 UTC
It's not exactly a good solution, but I've been patching knotify for a while now to use libcanberra instead. It's been working pretty well for me!

See the canberra branch here:
http://colin.guthr.ie/git/kdebase-runtime/

It's pretty old now but should apply cleanly still if you want to try it out.

The whole default device thing shouldn't really matter under KDE (provided you run start-pulseaudio-kde after restarting PA to reload the module-device-manager module) this is run automatically at startup and in future releases will be baked into PA itself so will be deprecated.... that's a good few months away tho'.
Comment 2 Richard Homonnai 2012-03-08 11:34:44 UTC
This happens for me now almost every day. I am using 4.7.4 - is this fixed in newer versions?
Comment 3 Colin Guthrie 2012-03-08 11:47:48 UTC
Not that I know of.

Have you tried the canberra patches I posted earlier? Does that avoid the problem for you?
Comment 4 Richard Homonnai 2012-03-08 12:44:02 UTC
(In reply to comment #3)
> Not that I know of.
> 
> Have you tried the canberra patches I posted earlier? Does that avoid the
> problem for you?

I only get "No repositories found" at the site. If the patch should work, maybe I can make a patched ebuild (using Gentoo).
Comment 5 Colin Guthrie 2012-03-08 12:54:51 UTC
Oh sorry, I guess the link is out of date:
http://colin.guthr.ie/git/kde-runtime/

I did a rebase not long ago, so the patches should all still apply (quite simple patches anyway)
Comment 6 Derick Eddington 2012-04-09 06:47:45 UTC
I suspect this bug is the same, or related to, a problem that happened with my install of Kubuntu 12.04 beta2: After Kubuntu was freshly installed, my keyboard volume control keys would not work, even though sound would play and when the keys were pressed the pop-up notification and the panel widget would display the change.

After wasting time reading about how to find various types of audio bugs, and then relearning that HDMI is for output (I've never used it), I finally realized that the problem was simply that KMix had chosen my HDMI as the "master channel" and I needed to change it to my built-in audio.

If this bug is related to my problem, it will be great if it will be fixed soon, because I can imagine unsavvy users giving up on KDE when they can't discover how to fix the problem before their patience expires.
Comment 7 Colin Guthrie 2012-04-09 10:08:43 UTC
@Derick: This is a different problem.
Comment 8 Dave Gilbert 2012-04-09 11:26:51 UTC
I should say this hasn't happened to me for a while (tempting fate!) - I'm on 4.8.2 now.
Comment 9 Richard Homonnai 2012-04-09 11:29:35 UTC
This happened for me again when I upgraded from 4.7.4 to 4.8.1

...it seems it happens when the system is loaded while starting KDE.
Comment 10 Richard Homonnai 2013-03-20 01:05:28 UTC
It still happens on 4.10.1.

This is Gentoo. Two identical systems, on one PA wins and all is peachy. On the other however knotify4 wins and PA misses the default audio device. All you can do at that moment is:

* kill knotify4
* kill PA
* kill knotify4 AGAIN
* start PA
* restart kmix
Comment 11 Richard Homonnai 2013-04-11 18:16:10 UTC
I found what the difference was on the two machines what SHOULD help a lot!

If I set phonon-gstreamer to higher priority, this problem happens, if I use phonon-vlc, then it doesn't. Don't know what to blame, but at least I have a working system again by prioritizing phonon-vlc.
Comment 12 Myriam Schweingruber 2013-04-13 08:55:45 UTC
Setting status correctly, might actually be backend related, see comment #11
Comment 13 Jean-Baptiste Kempf 2013-05-25 20:05:37 UTC
Don't use GStreamer :) :D
Comment 14 Justin Zobel 2021-03-09 22:36:52 UTC
Thank you for the bug report.

As this report hasn't seen any changes in 5 years or more, we ask if you can please confirm that the issue still persists.

If this bug is no longer persisting or relevant please change the status to resolved.
Comment 15 Richard Homonnai 2021-03-10 07:18:23 UTC
I haven't seen it for ages, using phonon-vlc (which is the default I guess?)