[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] remote: Prevent race when closing a connection



On Fri, Mar 15, 2013 at 10:50:08AM +0100, Viktor Mihajlovski wrote:
> On 03/15/2013 10:33 AM, Daniel P. Berrange wrote:
> >
> >No, this really isn't solving the problem. The virConnectDipose
> >function is the last thing to run on an object. Once virConnectDispose
> >is running absolutely nothing else may safely use that object pointer.
> >The thread that is not in virConnectDispose here is missing a reference
> >on the object, to prevent it being destroyed while it is still in use.
> >
> >so NACk to this patch, it doesn't fix the problem, merely makes a SEGV
> >slightly less likely.
> >
> >Daniel
> >
> 
> I understand your objection and I have already tested a patch which
> increments the object ref counter when registering a close callback.
> The unfortunate thing is that the close callback isn't guaranteed to
> be deregistered (causing a virsh leaked reference complaint). As my
> brain kicks in while I'm typing, this is probably the way to go ...

With the existing domain event callbacks we hold a reference on
the connection for as long as the callback is set. The app is
required to unregister the callbacks prior to closing the connection.
So the same approach is fine for the close callback.

To prevent the leak in virsh, virsh should be de-registering the
callback

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]