Bug 1876907 - Unwanted GLib error message is shown when virsh qemu-monitor-event command times out
Summary: Unwanted GLib error message is shown when virsh qemu-monitor-event command ti...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.2
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: rc
: 8.3
Assignee: Ján Tomko
QA Contact: Lili Zhu
URL:
Whiteboard: QJ200701-008/83Z
Depends On:
Blocks: 1861176
TreeView+ depends on / blocked
 
Reported: 2020-09-08 13:28 UTC by Ján Tomko
Modified: 2020-11-17 17:52 UTC (History)
13 users (show)

Fixed In Version: libvirt-6.6.0-5.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1861176
Environment:
Last Closed: 2020-11-17 17:51:44 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Ján Tomko 2020-09-08 13:28:57 UTC
Description of Problem:

  When virsh qemu-monitor-event command times out, unwanted Glib error message is shown as follows:

  -----------------------------------------------------------------------------
  # virsh qemu-monitor-event --timeout 1
  event loop timed out
  events received: 0
  
  (process:290446): GLib-CRITICAL **: 10:24:04.592: g_regex_unref: assertion 'regex != NULL' failed
  -----------------------------------------------------------------------------

Expected Results:
  -----------------------------------------------------------------------------
  # virsh qemu-monitor-event --timeout 1
  event loop timed out
  events received: 0
  
  -----------------------------------------------------------------------------

Comment 1 Ján Tomko 2020-09-08 13:30:43 UTC
Patch posted upstream:
https://www.redhat.com/archives/libvir-list/2020-September/msg00425.html

Comment 2 Ján Tomko 2020-09-08 14:36:49 UTC
Fixed upstream by:
commit 92b252456ee6d6ffc6e39e62ce1ce6c50113e00e
Author:     Ján Tomko <jtomko>
CommitDate: 2020-09-08 16:07:47 +0200

    check for NULL before calling g_regex_unref
    
    g_regex_unref reports an error if called with a NULL argument.
    
    We have two cases in the code where we (possibly) call it on a NULL
    argument. The interesting one is in virDomainQemuMonitorEventCleanup.
    
    Based on VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_REGEX, we unref
    data->regex, which has two problems:
    
    * On the client side, flags is -1 so the comparison is true even if no
      regex was used, reproducible by:
      $ virsh qemu-monitor-event --timeout 1
      which results in an ugly error:
    (process:1289846): GLib-CRITICAL **: 14:58:42.631: g_regex_unref: assertion 'regex != NULL' failed
    * On the server side, we only create the regex if both the flag and the
      string are present, so it's possible to trigger this message by:
      $ virsh qemu-monitor-event --regex --timeout 1
    
    Use a non-NULL comparison instead of the flag to decide whether we need
    to unref the regex. And add a non-NULL check to the unref in the
    VirtualBox test too.
    
    Signed-off-by: Ján Tomko <jtomko>
    Fixes: 71efb59a4de7c51b1bc889a316f1796ebf55738f
    https://bugzilla.redhat.com/show_bug.cgi?id=1876907
    Reviewed-by: Peter Krempa <pkrempa>
    Reviewed-by: Martin Kletzander <mkletzan>

git describe: v6.7.0-90-g92b252456e

Comment 7 Lili Zhu 2020-09-21 01:31:52 UTC
Reproduce this bug with:
libvirt-6.6.0-4.virtcov.el8.x86_64

# virsh qemu-monitor-event --timeout 1 
event loop timed out
events received: 0

(process:1732615): GLib-CRITICAL **: 21:21:10.896: g_regex_unref: assertion 'regex != NULL' failed

Comment 8 Lili Zhu 2020-09-21 05:24:56 UTC
Verify this bug with:
libvirt-6.6.0-6.virtcov.el8.x86_64

# virsh qemu-monitor-event --timeout 1 
event loop timed out
events received: 0

# virsh qemu-monitor-event 
^Cevent loop interrupted
events received: 0

Glib error message was not shown, mark the bug as verified

Comment 11 errata-xmlrpc 2020-11-17 17:51:44 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (virt:8.3 bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:5137


Note You need to log in before you can comment on or make changes to this bug.