Re: [PATCH v2] stream: Check for stream EOF

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

 



On 12.01.2012 11:13, Daniel P. Berrange wrote:
> On Thu, Jan 12, 2012 at 09:54:15AM +0100, Michal Privoznik wrote:
>> If client stream does not have any data to sink and neither received
>> EOF, a dummy packet is sent to the daemon signalising client is ready to
>> sink some data. However, after we added event loop to client a race may
>> occur:
>>
>> Thread 1 calls virNetClientStreamRecvPacket and since no data are cached
>> nor stream has EOF, it decides to send dummy packet to server which will
>> sent some data in turn. However, during this decision and actual message
>> exchange with server -
>>
>> Thread 2 receives last stream data from server. Therefore an EOF is set
>> on stream and if there is a call waiting (which is not yet) it is woken
>> up. However, Thread 1 haven't sent anything so far, so there is no call
>> to be woken up. So this thread sent dummy packet to daemon, which
>> ignores that as no stream is associated with such packet and therefore
>> no reply will ever come.
>>
>> This race causes client to hang indefinitely.
>> ---
>> diff to v1:
>> -moved client locking one level higher
>> -checking for stream EOF one level higher too
>>
>>  src/rpc/virnetclient.c       |   51 +++++++++++++++++++++++++++++++++++++-----
>>  src/rpc/virnetclient.h       |    3 ++
>>  src/rpc/virnetclientstream.c |    7 +++++-
>>  src/rpc/virnetclientstream.h |    2 +
>>  4 files changed, 56 insertions(+), 7 deletions(-)
> 
> ACK
> 
> 
> Daniel

Thanks, pushed.

Michal

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