• M
    stream: Check for stream EOF · 833b901c
    Michal Privoznik 提交于
    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.
    833b901c
virnetclient.c 52.4 KB