On 10/11/2013 10:50 AM, Daniel P. Berrange wrote:
On Fri, Oct 11, 2013 at 10:36:37AM -0600, Eric Blake wrote:
> On 10/11/2013 09:19 AM, Daniel P. Berrange wrote:
>> From: "Daniel P. Berrange" <berrange(a)redhat.com>
>>
>> The dbus_bus_get() function returns a shared bus connection that
>> all libraries in a process can use. You are forbidden from calling
>> close on this connection though, since you can never know if any
>> other code might be using it.
>
> Doesn't that mean that multiple calls to dbus_bus_get() return the same
> shared bus when possible rather than creating a new one? Thus, how
> would you run out of resources if no new bus is created on the second
> call? Or is it a case of a new bus per set of different arguments,
> where we are consuming lots of shared buses by passing different
> arguments every time?
The issue is that the call is made in the libvirt_lxc process,
and there's one of those per guest. So we have multiple connections.
Ah, so the _parent_ process (libvirtd) continues to share the bus, but
now has multiple long-lived lxc_process children. While we can't close
the bus in normal libvirt.so usage (because we don't know what else is
linked in to the app using the shared library), we CAN do it in
lxc_process (where we know the entire app, and know that lxc_process
doesn't care about dbus after setup is complete). Makes more sense. My
ACKs on code quality still stand, and now you can add my ACK to the
design :)
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org