[libvirt] [dbus PATCH 16/18] introduce support for libdbus library

Pavel Hrdina phrdina at redhat.com
Tue Mar 13 08:39:13 UTC 2018


On Mon, Mar 12, 2018 at 04:30:30PM +0000, Daniel P. Berrangé wrote:
> On Mon, Mar 12, 2018 at 05:21:46PM +0100, Pavel Hrdina wrote:
> > We will switch to libdbus library because the systemd sd-bus
> > implementation is not thread safe.
> 
> Hmmm, libdbus.so isn't all that great with threads either. It has
> had countless bugs in its thread support over the years to the
> extent that DBus maintainers have actively discouraged people from
> using it. GLib didn't even try to use it and wrote new bindings
> straight to the socket protocol for this reason.

They still claim it in their documentation that you should use
different API if possible but if you really want to you can use
libdbus directly but the only drawback from that claim is that
the API is low-level and hard to use.

Another claim from their documentation is that DBusConnection is thread
safe which is the only thing that libvirt-dbus requires to be thread
safe, they specifically say that DBusMessage doesn't have any thread
locks, but that's also OK since the DBusMessage will live only in one
thread.

I don't have any experience using libdbus (except this one) so if
threading is still not reliable and safe then it would be probably
better to use different API.  I've done some research about libdbus
before using it and yes, there ware some articles that it was broken
in the past, however nothing recent.

> Personally I think it would be worth considering using glib for
> libvirt-dbus. As well as getting access to a nicer DBus binding,
> you get to take advantage of higher level APIs that GLib provides
> compared to STDC / POSIX. The only real downside of using GLib
> is abort-on-OOM behaviour, but I don't think that's an issue for
> libvirt-dbus as its just an API shim layer.

I personally don't like GLib that much, but I can give it a try and
prepare alternative patches with GLib.

Pavel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180313/b0df50eb/attachment-0001.sig>


More information about the libvir-list mailing list