0001-Change-_dbus_exit-to-raise-SIGTERM-by-default.patch

Rémi Denis-Courmont remi at remlab.net
Wed Apr 28 00:27:12 PDT 2010


On Tue, 27 Apr 2010 22:34:49 +0200, Lennart Poettering <mzqohf at 0pointer.de>
wrote:
> On Tue, 27.04.10 14:32, Colin Walters (walters at verbum.org) wrote:
> 
>> New patch from IRC review:
>>
>> On Tue, Apr 27, 2010 at 1:42 PM, Colin Walters <walters at verbum.org>
> wrote:
>> > See patch.
> 
> Hmm, are you sure this is safe? Most SIGTERM handlers will probably use
> the
> pipe trick (or even signalfd()) to pass the signal back to the main
> loop. That means the the SIGTERM only sets a flag, and execution is
> continued after _dbus_exit(). Not sure if all existing apps which rely
> on this exiting behaviour are really coded in a way that it is safe to
> delay the exit.

It also fails miserably to achieve what was intended if SIGTERM is blocked.
This could happen if the process uses a ppoll() loop, or in a multi-thread
application using sigwait(). In the latter case, there is no signal
handler, so it won't work anyway.

Also do note that 'raise(sig)' is equivalent to
'pthread_kill(pthread_self(), sig)' rather than 'kill(0, sig)'; I am not
sure which one you meant.

IMHO, if you want to register handle a custom handler for DBus
disconnections, you should extend DBus to provide a dedicated function,
akin to Xlib's XSetIOErrorHandler() (which is by design not thread-safe by
the way :( ).

-- 
Rémi Denis-Courmont
http://www.remlab.net
http://fi.linkedin.com/in/remidenis



More information about the dbus mailing list