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 -----------------------------------------------------------------------------
Patch posted upstream: https://www.redhat.com/archives/libvir-list/2020-September/msg00425.html
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
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
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
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