Bug 10022

Summary: [1.0.2] activated services are not shutdown with the bus
Product: dbus Reporter: Joshua N. Pritikin <joshua>
Component: coreAssignee: Havoc Pennington <hp>
Status: RESOLVED DUPLICATE QA Contact: John (J5) Palmieri <johnp>
Severity: normal    
Priority: medium CC: joshua
Version: unspecified   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Joshua N. Pritikin 2007-02-18 09:09:16 UTC
When testing Sugar (OLPC) on Debian, I find that suger-clipboard (a dbus activated service) is not shutdown when I ^C the dbus.

I'm not a dbus expert but it looks like (http://dbus.freedesktop.org/doc/diagram.png) you keep a TCP connection between the dbus and all dbus connected processes. So you should be able to detect a SIGPIPE or read error on the socket and shutdown.

Relate suspicious evidence is that activated processes start in a detach/daemonized state (parent=init instead of parent=dbus). This doesn't make any sense since you _want_ a parent/child relationship between the dbus and activated services, no? So you are going to the extra trouble of daemonizing when it seems counterproductive.
Comment 1 Joshua N. Pritikin 2007-02-18 09:12:40 UTC
John (J5) Palmieri wrote:
> If you have a D-Bus connection open and the exit on disconnect flag is
> enabled (default) then it should be killed when the connection
> disconnects (i.e. the bus goes away).
Comment 2 John (J5) Palmieri 2007-02-18 11:29:05 UTC
We detach from the bus on purpose.  You can start a service up without using D-Bus activation and it should behave exactly the same as if it were activated by the bus.  Some services wish to survive D-Bus restarts (in which case they set exit_on_disconnect to false).  I'll take a look at the clipboard service to see what is going on.  I suspect it is something in the python bindings.
Comment 3 Havoc Pennington 2007-02-18 13:11:05 UTC
I don't think there's a dbus bug here. libdbus does default to exiting on disconnect from the bus. The default may or may not be right for Sugar; it's right for pretty much every normal desktop-type app, but Sugar has its own setup. In any case, libdbus lets the app choose whether to exit on disconnect or not, so if there's a bug here, it's in the app.
Comment 4 Joshua N. Pritikin 2007-02-19 01:33:32 UTC
Thanks for the hint, j5. conn-methods.c:277 "The default is for this feature to be disabled for Connections and enabled for Buses"

So we probably just need to enable it. I will follow up.
Comment 5 Joshua N. Pritikin 2007-02-19 01:36:46 UTC
Can dbus-launch --exit-with-session watch for SIGINT as well as SIGTERM? It seems counterintuitive that these two signals cause very different behavior.
Comment 6 Joshua N. Pritikin 2007-03-04 01:25:41 UTC
Can we have some action on this bug? It's not like I am asking for the moon.
Comment 7 Simon McVittie 2011-02-28 09:21:08 UTC
(In reply to comment #5)
> Can dbus-launch --exit-with-session watch for SIGINT as well as SIGTERM?

Seems to be Bug #23977.

*** This bug has been marked as a duplicate of bug 23977 ***

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.