'Twas brillig, and Colin Guthrie at 28/02/11 20:26 did gyre and gimble: > Hi, > > Just cataloguing my issues so we don't forget.... > > 1. It seems that when running pulseaudio -k, that the daemon terminates > pretty brutally... I'm not yet sure if the daemon dies horribly or just > doesn't unload the modules properly. Due to this, the X11 properties on > the root window are left over (because they were inserted by > module-x11-publish). Due to this, the daemon will not autospawn or be > started properly. > > This indicates two separate problems: > a) The module shutdown process is not quite working right. > b) The code that detects whether the connection params (in the left > over x11 props) are meant to be local (which indicates a crash) so that > autospawn or manual startup will proceed successfully.
OK, I've not debugged part a) here but I've taken a look at b). It turns out this behaviour was introduced in: commit f1d1447e104c4f609c0e8c528b56ea6afa540b95 Author: Tanu Kaskinen <ta...@iki.fi> Date: Sat Jan 9 11:55:15 2010 +0200 daemon: Don't autospawn if a server address is explicitly configured. This has a slight problem. I'll just past the commit message of my patch to resolve this issue as it explains it. Does this patch look OK to everyone (especially Tanu!) daemon: Fix regression introduced in f1d1447e. With Tanu's patch, the server no longer starts when a server is configured. While this is sensible in most circumstances there is a corner case where we still want to start. In a typical X11 login, module-x11-publish will be loaded and will thus set the PULSE_SERVER X11 property on the root window. This then hits the check introduced in f1d1447e and exits. If PA had previously crashed (thus leaving behind it's X11 properties) then this means that we will not autospawn nor even allow ourselves to be started manually until pax11publish -r is run to clear out the X11 properties. This is obviously not desirable. This patch introduces a more in-depth check of the server. If it looks like a local unix domain socket, then we do not exit straight away and instead probe further. This should not pose any problems with e.g. remote SSH usage as the DBus Machine ID is used in the server string. Thanks. Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mageia Contributor [http://www.mageia.org/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/]
From be348962108e8c6085dff65a99262c7cfeb17a7b Mon Sep 17 00:00:00 2001 From: Colin Guthrie <cguth...@mandriva.org> Date: Fri, 25 Mar 2011 23:03:31 +0000 Subject: [PATCH] daemon: Fix regression introduced in f1d1447e. With Tanu's patch, the server no longer starts when a server is configured. While this is sensible in most circumstances there is a corner case where we still want to start. In a typical X11 login, module-x11-publish will be loaded and will thus set the PULSE_SERVER X11 property on the root window. This then hits the check introduced in f1d1447e and exits. If PA had previously crashed (thus leaving behind it's X11 properties) then this means that we will not autospawn nor even allow ourselves to be started manually until pax11publish -r is run to clear out the X11 properties. This is obviously not desirable. This patch introduces a more in-depth check of the server. If it looks like a local unix domain socket, then we do not exit straight away and instead probe further. This should not pose any problems with e.g. remote SSH usage as the DBus Machine ID is used in the server string. --- src/daemon/main.c | 48 ++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 44 insertions(+), 4 deletions(-) diff --git a/src/daemon/main.c b/src/daemon/main.c index f939313..1879870 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -90,6 +90,7 @@ #include <pulsecore/once.h> #include <pulsecore/shm.h> #include <pulsecore/memtrap.h> +#include <pulsecore/strlist.h> #ifdef HAVE_DBUS #include <pulsecore/dbus-shared.h> #endif @@ -673,10 +674,49 @@ int main(int argc, char *argv[]) { } if (conf->cmd == PA_CMD_START && (configured_address = check_configured_address())) { - pa_log_notice(_("User-configured server at %s, not autospawning."), configured_address); - pa_xfree(configured_address); - retval = 0; - goto finish; + /* There is an server address in our config, but where did it come from? + * By default a standard X11 login will load module-x11-publish which will + * inject PULSE_SERVER X11 property. If the PA daemon crashes, we will end + * up hitting this code path. So we have to check to see if our configured_address + * is the same as the value that would go into this property so that we can + * recover (i.e. autospawn) from a crash. + */ + char *ufn; + pa_bool_t start_anyway = FALSE; + + if ((ufn = pa_runtime_path(PA_NATIVE_DEFAULT_UNIX_SOCKET))) { + char *id; + + if ((id = pa_machine_id())) { + pa_strlist *server_list; + char formatted_ufn[256]; + + pa_snprintf(formatted_ufn, sizeof(formatted_ufn), "{%s}unix:%s", id, ufn); + pa_xfree(id); + + if ((server_list = pa_strlist_parse(configured_address))) { + char *u = NULL; + + /* We only need to check the first server */ + server_list = pa_strlist_pop(server_list, &u); + pa_strlist_free(server_list); + + start_anyway = (u && pa_streq(formatted_ufn, u)); + pa_xfree(u); + } + } + pa_xfree(ufn); + } + + if (start_anyway) { + pa_log_notice(_("User-configured server at %s, which appears to be local. Probing deeper."), configured_address); + pa_xfree(configured_address); + } else { + pa_log_notice(_("User-configured server at %s, refusing to start/autospawn."), configured_address); + pa_xfree(configured_address); + retval = 0; + goto finish; + } } if (conf->system_instance && !conf->disallow_exit) -- 1.7.4.1
_______________________________________________ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss