On Wed, Dec 05, 2012 at 10:48:44PM +0800, Osier Yang wrote: > https://bugzilla.redhat.com/show_bug.cgi?id=866524 > > Since the virConnect object is not locked wholely when doing > virConenctDispose, a thread can get the lock and thus might > cause the race. > This patch is to fix it by locking the whole virConnect object when > disposing it. No, this is wrong. If two threads are using an object, they must each be holding a reference on the object. virConnectDispose is the *last* thing to happen to an object. If a 2nd thread is still using an object when virConnectDipose runs, then by definition, it has forgotten to hold a reference count. Locking cannot save you at this point - the 2nd thread will end up waiting on a mutex that has been destroyed NACK Daniel -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list