[Patch] Auto-Close dbus-daemon when unused

Leon Winter winter-dbus at bfw-online.de
Thu Sep 24 02:58:21 PDT 2015


Hi,

we are running a Debian-based thin client setup with a central big machine and
several lightweight clients. Since users run normal desktop applications like
evince or firefox, dbus-daemons for their sessions are started. When they log
out however, the dbus-daemons continue to linger around. Often only a single
application during the whole session requires dbus. Yet after the dbus-daemon is
initially launched, it sticks around. This all results in many dbus-daemon
processes running without any use. Thus for our setup we would like the
dbus-daemon to automatically terminate when it is not actually used any more.
To accomplish just that, we patched dbus to keep track of the connected clients
and auto-launched services. Additionally it sets up a timer. Once the timer
expires, dbus checks if anyone actually uses it and conditionally quits.

At this point, I would like to ask if upstream would be willing to adapt such a
(optional) behaviour. Unlike most users, we are not running dbus on a single
user machine but share it with many users. Additionally we are not rebooting the
system for each session. Also most our applications are not requiring dbus which
might be uncommon for Linux Desktop environments. Therefore I assume our setup
differs a lot from a the average desktop user and the mentioned feature might be
unfit for upstream inclusion.

We have already implemented said feature in our dbus. The code quality should be
considered "proof of concept". Albeit we are using it for many years now, it is
not of best quality. This mostly stems from the fact that certain data
structures need to be modified at locations where it is currently not desired to
do so. To modify such structures one does need to know their design which was
currently specified in the .c implementation and was ripped out into a header
file.

In the end it comes down to the questions:
- Would you consider such a (optional) feature (to included upstream)?
- Would you consider changing some internal APIs/structures to make it easier to
  add such a feature downstream?
- Do you know another way of running dbus achieving the same effect but without
  modifications?

To give you an idea of the PoC for the feature I included a patch which applies
to the Debian source package of dbus 1.10.

Thanks,
Leon Winter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbus-1.10.diff
Type: text/x-diff
Size: 26500 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20150924/bb4e1e8c/attachment.diff>


More information about the dbus mailing list