qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>, qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, mreitz@redhat.com
Subject: Re: [PATCH 2/3] python/qemu: Kill QEMU process if 'quit' doesn't work
Date: Mon, 16 Mar 2020 15:57:43 -0400	[thread overview]
Message-ID: <a50e86c2-97b5-d318-d061-016299b5c8dd@redhat.com> (raw)
In-Reply-To: <20200313083617.8326-3-kwolf@redhat.com>



On 3/13/20 4:36 AM, Kevin Wolf wrote:
> 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>

> ---
>  python/qemu/machine.py | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/python/qemu/machine.py b/python/qemu/machine.py
> index 183d8f3d38..c837ee8723 100644
> --- a/python/qemu/machine.py
> +++ b/python/qemu/machine.py
> @@ -358,6 +358,7 @@ class QEMUMachine(object):
>                      if not has_quit:
>                          self._qmp.cmd('quit')
>                      self._qmp.close()
> +                    self._popen.wait(timeout=3)
>                  except:
>                      self._popen.kill()
>              self._popen.wait()
> 

-- 
—js



  reply	other threads:[~2020-03-16 19:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-13  8:36 [PATCH 0/3] iotests: Fix intermittent 030 hang Kevin Wolf
2020-03-13  8:36 ` [PATCH 1/3] iotests.py: Enable faulthandler Kevin Wolf
2020-03-16 19:56   ` John Snow
2020-03-13  8:36 ` [PATCH 2/3] python/qemu: Kill QEMU process if 'quit' doesn't work Kevin Wolf
2020-03-16 19:57   ` John Snow [this message]
2020-03-20 10:15   ` Philippe Mathieu-Daudé
2020-03-13  8:36 ` [PATCH 3/3] iotests: Increase pause_wait() timeout Kevin Wolf
2020-03-16 19:58   ` John Snow
2020-03-20 10:21   ` Philippe Mathieu-Daudé
2020-03-23 18:30     ` John Snow
2020-03-20 10:12 ` [PATCH 0/3] iotests: Fix intermittent 030 hang Philippe Mathieu-Daudé
2020-03-22 11:16 ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a50e86c2-97b5-d318-d061-016299b5c8dd@redhat.com \
    --to=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).