'Twas brillig, and Colin Guthrie at 25/03/11 23:36 did gyre and gimble: > 'Twas brillig, and Colin Guthrie at 25/03/11 23:09 did gyre and gimble: >> '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). > > OK, I've debugged part a) now.... and I suspect it's probably also > something Tanu will have to comment on. > > During a normal shut down, the pa_core is unreffed. Normally this will > result in the refcnt reaching zero and the core_free() function being > called. > > This normally works fine, but when the dbus protocol is loaded, it refs > the core and in so doing, it effectively prevents the clean shutdown of > the daemon. > > I suspect that we'll need to handle dbus protocol tidy up specifically > by unloading it in the daemon/main.c or find some way to not ref the > core in the dbus stuff - is it actually safe enough to simply not call > pa_core_ref/pa_core_unref? (with the exception being the pa_core_unref > in daemon/main.c obviously!) > > Any other ideas welcome too of course :)
FWIW, the attached patch seems to work for me... simply not ref'ing the core. If this is OK, then I'll push it. Cheers 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 1e381fbffc190fdede27d6f27a2d113daf3e791d Mon Sep 17 00:00:00 2001 From: Colin Guthrie <cguth...@mandriva.org> Date: Fri, 25 Mar 2011 23:43:26 +0000 Subject: [PATCH] dbus: Do not refcnt the core. We should not call pa_core_ref() anywhere in the code. Doing so will prevent proper daemon shutdown as the only call (in daemon/main.c) to pa_core_unref() should always call free_core() and perform a normal shutdown (i.e. unload all modules gracefully). --- src/modules/dbus/iface-core.c | 3 +-- src/modules/dbus/iface-memstats.c | 3 +-- src/pulsecore/protocol-dbus.c | 4 +--- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/modules/dbus/iface-core.c b/src/modules/dbus/iface-core.c index 268a87e..bb43df9 100644 --- a/src/modules/dbus/iface-core.c +++ b/src/modules/dbus/iface-core.c @@ -1975,7 +1975,7 @@ pa_dbusiface_core *pa_dbusiface_core_new(pa_core *core) { pa_assert(core); c = pa_xnew(pa_dbusiface_core, 1); - c->core = pa_core_ref(core); + c->core = core; c->subscription = pa_subscription_new(core, PA_SUBSCRIPTION_MASK_ALL, subscription_cb, c); c->dbus_protocol = pa_dbus_protocol_get(core); c->cards = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func); @@ -2124,7 +2124,6 @@ void pa_dbusiface_core_free(pa_dbusiface_core *c) { pa_source_unref(c->fallback_source); pa_dbus_protocol_unref(c->dbus_protocol); - pa_core_unref(c->core); pa_xfree(c); } diff --git a/src/modules/dbus/iface-memstats.c b/src/modules/dbus/iface-memstats.c index 73a84be..4cd692d 100644 --- a/src/modules/dbus/iface-memstats.c +++ b/src/modules/dbus/iface-memstats.c @@ -202,7 +202,7 @@ pa_dbusiface_memstats *pa_dbusiface_memstats_new(pa_dbusiface_core *dbus_core, p pa_assert(core); m = pa_xnew(pa_dbusiface_memstats, 1); - m->core = pa_core_ref(core); + m->core = core; m->path = pa_sprintf_malloc("%s/%s", PA_DBUS_CORE_OBJECT_PATH, OBJECT_NAME); m->dbus_protocol = pa_dbus_protocol_get(core); @@ -219,7 +219,6 @@ void pa_dbusiface_memstats_free(pa_dbusiface_memstats *m) { pa_xfree(m->path); pa_dbus_protocol_unref(m->dbus_protocol); - pa_core_unref(m->core); pa_xfree(m); } diff --git a/src/pulsecore/protocol-dbus.c b/src/pulsecore/protocol-dbus.c index 13c05d9..c329915 100644 --- a/src/pulsecore/protocol-dbus.c +++ b/src/pulsecore/protocol-dbus.c @@ -125,7 +125,7 @@ static pa_dbus_protocol *dbus_protocol_new(pa_core *c) { p = pa_xnew(pa_dbus_protocol, 1); PA_REFCNT_INIT(p); - p->core = pa_core_ref(c); + p->core = c; p->objects = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); p->connections = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func); p->extensions = pa_idxset_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); @@ -178,8 +178,6 @@ void pa_dbus_protocol_unref(pa_dbus_protocol *p) { pa_assert_se(pa_shared_remove(p->core, "dbus-protocol") >= 0); - pa_core_unref(p->core); - pa_xfree(p); } -- 1.7.4.1
_______________________________________________ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss