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

Viktor Mihajlovski mihajlov at linux.vnet.ibm.com
Fri Mar 15 09:50:08 UTC 2013


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 ...

-- 

Mit freundlichen Grüßen/Kind Regards
    Viktor Mihajlovski

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martina Köderitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294




More information about the libvir-list mailing list