Uh oh!
There was an error while loading. Please reload this page.
fix pulseaudio re-start command line - #300
Conversation
When running a kmod-load-unload test locally on a Ubuntu 20.04 machine, it couldn't re-start pulseaudio, the reason was, that the script was trying to start the command in the form ' pulseaudio -D' i.e. with several spaces in front of the executable name and that didn't work. Whereas just using the line as obtained from "ps" output works. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
marc-hb
commented
Jul 30, 2020
Thanks @lyakh for looking at the pulseaudio situation, I'm afraid you don't realize what you're getting yourself into :-) Now if you think you can (gradually) improve this situation then great! Can you first try to (partially?) revert c7d2477? I think it was not well tested and buggy, see discussion about this commit in PR #266 which maybe related to yours. I think extracting pulseaudio arguments from the output of BTW I created a new label "pulseaudio" in sof-test for convenience, please click on it on the right side of this page. |
lyakh
commented
Jul 31, 2020
@marc-hb not sure I wanted to go as far as changing the world (TM) by fixing pulseaudio ;-) There might be slightly more or less correct ways of doing something, e.g. of stopping and re-starting PA, specifying or not specifying environment, missing some command-line arguments, starting as a wrong user, etc. But not starting at all because of a wrong process name should be fixed IMHO. |
marc-hb
commented
Jul 31, 2020
Understood. I would still like someone (you?) to explore the history of |
lyakh
commented
Aug 3, 2020
I looked at c7d2477 Though it doesn't strike me as a feat of elegance, it says it's fixing some error checking bug and by just looking at it I'm not sure I know what that bug was. So, reverting it completely or even some not fully understood and unverified parts of it might bring that bug back. |
marc-hb
left a comment
There was a problem hiding this comment.
I spent a bit more time looking at the pulseaudio situation. I think the entire approach in this script is broken, as somewhat confirmed by #289 (comment)
We tried a lot of ways to deal with pulseaudio, but in vain.
It's broken because on Ubuntu (and probably many others), pulseaudio is started by systemd's pulseaudio.socket as described by @juimonen in #289
This implies at least two issues:
pulseaudio will restart even after having been "disabled" by
func_lib_disable_pulseaudio()which should really be calledfunc_lib_fail_to_kill_pulseaudio(). A simpleaplaycommand is enough to restart pulseaudio, I just checked.As already discussed in #266,
systemdstarts pulseaudio with--daemonize=nowhich causes various issues when re-using that parameter.
Instead of these functions we should use the systemd one-liners suggested by @juimonen in #289.
In the meantime the only configuration officially supported by sof-test is apt remove pulseaudio
All this being said, I'm approving because if you think it works for you sometimes then why not. These functions are considered "not in service" anyway.
lyakh
commented
Aug 13, 2020
@marc-hb thanks, without this patch I cannot run tests at all, so, yes, it seems like an improvement to me. |
marc-hb
commented
Aug 13, 2020
Before running sof-test you should either |
lyakh
commented
Aug 14, 2020
@marc-hb that doesn't sound like a good idea to me. Firstly we want to test with pulseaudio, that's how SOF has to function, secondly if I understand correctly sof-test only tries to disable PA for module loading-unloading tests and only unless a parameter is specified explicitly to block that behaviour. |
marc-hb
commented
Aug 14, 2020
There are different levels of testing. For the lowest level and most fundamental and most important level of testing we don't want pulseaudio to interfere with the tests (it has been for a very long time)
That's not my understanding.
As @aiChaoSONG mentioned there has already been an enormous amount of time spent trying to disable and re-enable pulseaudio dynamically. Since it has failed repeatedly (and inconsistently), pulseaudio is now removed. See above where I could reproduce one of these undesired autospawns in minutes. I'm afraid these attempts didn't use |
lyakh
commented
Aug 14, 2020
@kv2019i I think it was you who suggested, that since we now always run with PA enabled "in the field" i.e. on Linux laptops and the like, that's also how we should test? And that even some use-cases won't work without it? |
paulstelian97
commented
Aug 14, 2020
First of all test without PA to ensure the driver and firmware are okay, then test with as well to compare. Some issues are due to PA configuration and the UCM... |
plbossart
commented
Aug 14, 2020
I agree with @lyakh that you cannot ask testers to remove pulseaudio on their target machines. |
marc-hb
commented
Aug 15, 2020
CI systems would ideally have as few differences as possible with real world systems. Unfortunately removing pulseaudio on them is the best we can do for now. Patches welcome! PS: removing and re-installing pulseaudio with apt takes seconds. |
kv2019i
commented
Aug 17, 2020
To @lyakh, ack on @paulstelian97 's reply that it is perfectly valid to have both -- e.g. to have a set of tests where Pulseaudio should be disabled and another with the full vertical stack (including Pulseaudio). Given we target a more limited set of distros, disabling Pulseaudio from the script in a robust way, should still be a doable task (and yes, I understand patches are welcome). In wider context of upstream bugs, I usually ask the bug reporter to rename the PA binary and kill all PA processes. This is a minimal procedure that works 100% of the time, but for our CI scripts, I believe we can have something cleaner... and not require to uninstall PA. |
lgirdwood
commented
Aug 17, 2020
fwiw systemd may be respawning pulseaudio too (since it seems to ignore it's own "no respawn" config). |
kv2019i
commented
Aug 17, 2020
@lgirdwood wrote:
That's one aspect that complicates life in wider context of Linux systems, but in our case (mostly Ubuntu/Fedora), Pulseaudio is run as part of the user session and not as a system-wide daemon. So these instructions to stop Pulseaudio and disabling autospawn should work for all CI cases: https://wiki.debian.org/PulseAudio . But yeah, in wider context, there are a lot more options -- Arch Linux installs a systemd service and e.g. Pulseaudio Snap for Ubuntu adds a systemd unit for some reason -- and then you have to worry about the separate spawn mechanisms of systemd. |
I forgot to remove pulseaudio and my test script (as root) just hung forever because: Ctrl-Z
ps f
sudo -u user /usr/bin/pulseaudio --daemonize=no --log-target=journalI admittedly did NOT have autospawn and systemd configured not to start it. I just found this other knob by chance: |
Sort of fixes commit 8b02299 ("fix pulseaudio re-start command line"). The whole pulseaudio situation is a mess anyway, see PR thesofproject#300 and others. Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Sort of fixes commit 8b02299 ("fix pulseaudio re-start command line"). The whole pulseaudio situation is a mess anyway, see PR thesofproject#300 and others. Signed-off-by: Marc Herbert <marc.herbert@intel.com>
When running a kmod-load-unload test locally on a Ubuntu 20.04 machine, it couldn't re-start pulseaudio, the reason was, that the script was trying to start the command in the form ' pulseaudio -D' i.e. with several spaces in front of the executable name and that didn't work. Whereas just using the line as obtained from "ps" output works.
I'm not sure how reliable this solution is. But it also boils down to whether we should use
psoutput to re-start pulseaudio or just usepulseaudio --start. Maybe the latter would be more reliable.