Re: [libvirt-1.0.5]deadlock in child process after call function backtrace, any suggestions is appreciate!

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

 



On 07/05/2013 08:00 AM, Laine Stump wrote:
> On 07/04/2013 01:43 AM, Caizhifeng wrote:
>> Hi ALL,
>>
>> In order to catch the calltrace of deadlock in libvirtd, I modified the function virMutexLock as follows:
>>

>>
>> But, unfortunatly, sometimes, deadlock happened in child process after virFork,
> 
> The problem is that backtrace() is not "async signal safe". The section
> "Async-signal-safe functions" of "man 7 signal" explains what this is in
> the context of a signal handler, but the conditions in a child process
> just after fork() are really the same - a lock was acquired in one
> thread of the parent, then *while that lock is being held* a different
> thread of the parent calls fork(), which duplicates all of the process'
> memory (including the lock) then creates a new process. In the new
> process, the lock comes into existence marked as being held, but there
> is no thread to unlock it, so when the child attempts to acquire the
> lock, it waits forever.

FYI, I'm in the middle of fixing such a bug in our usage of
virSetUIDGID, which is another instance of calling a non-async-safe
function after fork.

-- 
Eric Blake   eblake redhat com    +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]