backup: fix deadlock on error while receiving backup from a VM
When qfile-dom0-unpacker detects an error, it sends error report to stdout and terminate (so stdout is closed). That close should be transferred to the VM process (as EOF on its stdin), which will signal it to stop sending the data and handle error report. Also qrexec-client holds the connection until both stdin and stdout are closed. So when that EOF is missing, tar2qfile will not detect error report and still tries to send the data and qrexec-client will hold the connection while receiving process is long dead. To prevent that deadlock from happening, close FD in python code, so qfile-dom0-unpacker will be the last owner of write end of the pipe. When it closes its stdout, qrexec-client will receive EOF at its stdin.
This commit is contained in:
parent
affb39f435
commit
bdae560770
@ -1285,6 +1285,10 @@ def restore_vm_dirs (backup_source, restore_tmpdir, passphrase, vms_dirs, vms,
|
||||
# to the VM), while tar output filelist on stdout
|
||||
if appvm:
|
||||
filelist_pipe = command.stderr
|
||||
# let qfile-dom0-unpacker hold the only open FD to the write end of
|
||||
# pipe, otherwise qrexec-client will not receive EOF when
|
||||
# qfile-dom0-unpacker terminates
|
||||
vmproc.stdin.close()
|
||||
else:
|
||||
filelist_pipe = command.stdout
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user