Skip to content

VIRTWINKVM-2680: [QMP] flush pending events in wait_for to handle guest-side crashes - #1099

Open
harshapa-rh wants to merge 1 commit into
HCK-CI:masterfrom
harshapa-rh:fix-qmp-socket
Open

VIRTWINKVM-2680: [QMP] flush pending events in wait_for to handle guest-side crashes#1099
harshapa-rh wants to merge 1 commit into
HCK-CI:masterfrom
harshapa-rh:fix-qmp-socket

Conversation

@harshapa-rh

@harshapa-rh harshapa-rh commented Aug 11, 2026

Copy link
Copy Markdown

When a crash is triggered from inside the guest (e.g. via NotMyFault over WinRM) rather than via a QMP command (e.g. inject-nmi), the QMP socket has no recent I/O activity. This can cause QEMU to not flush pending events like GUEST_PANICKED to the socket, making wait_for_new_event block until timeout.

Fix this by:

  1. Sending a query-status command in wait_for before entering the blocking wait loop, which forces QMP negotiation and flushes any pending events into the cache.
  2. Using @socket_internal.wait_readable(2) with a 2 sec interval in wait_for_new_event so that if the event hasn't arrived yet, a periodic query-status poke forces QEMU to flush its event buffer.

After each poke, the event cache is re-checked since send_cmd's internal read loop may have consumed and buffered the target event.

Comment thread lib/setupmanagers/qemuhck/qmp.rb Fixed
…st-side crashes

When a crash is triggered from inside the guest (e.g. via NotMyFault
over WinRM) rather than via a QMP command (e.g. inject-nmi), the QMP
socket has no recent I/O activity. This can cause QEMU to not flush
pending events like GUEST_PANICKED to the socket, making
wait_for_new_event block until timeout.

Fix this by:
1. Sending a query-status command in wait_for before entering the
   blocking wait loop, which forces QMP negotiation and flushes any
   pending events into the cache.
2. Using IO.wait_readable with a 2 sec interval in wait_for_new_event
   so that if the event hasn't arrived yet, a periodic query-status
   poke forces QEMU to flush its event buffer.

After each poke, the event cache is re-checked since send_cmd's
internal read loop may have consumed and buffered the target event.

Signed-off-by: Harshal Patil <harshapa@redhat.com>
@kostyanf14

Copy link
Copy Markdown
Contributor

ok to test

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds periodic QMP activity to flush pending guest crash events.

Changes:

  • Sends query-status before waiting.
  • Periodically retries and rechecks cached events.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

cached = find_cached_event(name, accepted)
return cached if cached

run_cmd('query-status')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants