Re: segment fault from libvirtmod

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

 



On 02/06/2012 07:59 AM, Michal Privoznik wrote:

> Running git bisect showed it was caused by
> c700613b8d463212d142c97108b7a2352e23e559. However, I think it only
> exposed the design problem we are facing here.
> 
> IMHO problem is when an application tries to call virConnectOpen() (or
> virConnectOpenAuth()) from two concurrent threads. This is what will happen:
> 
> 1st thread:
>   call virConnectOpen();
>   global variable @initialized == zero; thus virInitialize() is called,
> error object is set up (via virErrorInitialize()) which is thread local
> variable. However, @initialized is set to 1 in the first place.
> 
> 2nd thread:
>   call virConnectOpen() as well;
>   @initialized is already set, therefore no thread local variable is set
> and any error report will fail.

Ouch - I agree with your analysis of a thread-safety issue.  I think we
can fix it by making virInitialize() delegate most of its work to a
virOnce() initialization function.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]