mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
python/qemu: Kill QEMU process if 'quit' doesn't work
With a QEMU bug, it can happen that the QEMU process doesn't react to a 'quit' QMP command. If we got an exception during previous QMP communication (e.g. iotests Timeout expiring), we could also be in an inconsistent state where after sending 'quit' we immediately read an old response and close the socket even though the 'quit' command wasn't processed yet. Both cases would lead to a hanging test. Fix this by waiting for the QEMU process to exit after sending 'quit' with a timeout, and if it doesn't happen within three seconds, send SIGKILL. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20200313083617.8326-3-kwolf@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
aa1cbeb86b
commit
cd87f5e378
1 changed files with 1 additions and 0 deletions
|
@ -359,6 +359,7 @@ def shutdown(self, has_quit=False):
|
|||
if not has_quit:
|
||||
self._qmp.cmd('quit')
|
||||
self._qmp.close()
|
||||
self._popen.wait(timeout=3)
|
||||
except:
|
||||
self._popen.kill()
|
||||
self._popen.wait()
|
||||
|
|
Loading…
Reference in a new issue