|
|
4aa5c4 |
From b550b671bace6d979a0763a837ce97ddf72e8fc8 Mon Sep 17 00:00:00 2001
|
|
|
4aa5c4 |
Message-Id: <b550b671bace6d979a0763a837ce97ddf72e8fc8@dist-git>
|
|
|
4aa5c4 |
From: Martin Kletzander <mkletzan@redhat.com>
|
|
|
4aa5c4 |
Date: Fri, 28 Jan 2022 20:33:12 +0100
|
|
|
4aa5c4 |
Subject: [PATCH] RHEL: Remove
|
|
|
4aa5c4 |
|
|
|
4aa5c4 |
https://bugzilla.redhat.com/show_bug.cgi?id=2045879
|
|
|
4aa5c4 |
|
|
|
4aa5c4 |
This is to accommodate for RHEL 8 downstream glib being fixed with a backport in
|
|
|
4aa5c4 |
version 2.56.4-12 (Bug 1948988). Another reason for that is that our workaround
|
|
|
4aa5c4 |
does not play nice with a fixed glib, leading to libvirt not properly
|
|
|
4aa5c4 |
dereferencing the monitor socket, eventually leading to EMFILE: Too many open
|
|
|
4aa5c4 |
files.
|
|
|
4aa5c4 |
|
|
|
4aa5c4 |
RHEL-only
|
|
|
4aa5c4 |
|
|
|
4aa5c4 |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
4aa5c4 |
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
4aa5c4 |
---
|
|
|
4aa5c4 |
src/util/glibcompat.c | 46 ++++++++-----------------------------------
|
|
|
4aa5c4 |
1 file changed, 8 insertions(+), 38 deletions(-)
|
|
|
4aa5c4 |
|
|
|
4aa5c4 |
diff --git a/src/util/glibcompat.c b/src/util/glibcompat.c
|
|
|
4aa5c4 |
index eb6dcc0111..bf890f10d2 100644
|
|
|
4aa5c4 |
--- a/src/util/glibcompat.c
|
|
|
4aa5c4 |
+++ b/src/util/glibcompat.c
|
|
|
4aa5c4 |
@@ -212,51 +212,21 @@ vir_g_strdup_vprintf(const char *msg, va_list args)
|
|
|
4aa5c4 |
return ret;
|
|
|
4aa5c4 |
}
|
|
|
4aa5c4 |
|
|
|
4aa5c4 |
-
|
|
|
4aa5c4 |
/*
|
|
|
4aa5c4 |
- * If the last reference to a GSource is released in a non-main
|
|
|
4aa5c4 |
- * thread we're exposed to a race condition that causes a
|
|
|
4aa5c4 |
- * crash:
|
|
|
4aa5c4 |
- *
|
|
|
4aa5c4 |
- * https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1358
|
|
|
4aa5c4 |
+ * This is a leftover of a hack that works around glib older than 2.64.0, but
|
|
|
4aa5c4 |
+ * the fix in glib as backported in RHEL-8 to glib2-2.56.4-12 in BZ 1948988:
|
|
|
4aa5c4 |
*
|
|
|
4aa5c4 |
- * Thus we're using an idle func to release our ref...
|
|
|
4aa5c4 |
+ * https://bugzilla.redhat.com/show_bug.cgi?id=1948988
|
|
|
4aa5c4 |
*
|
|
|
4aa5c4 |
- * ...but this imposes a significant performance penalty on
|
|
|
4aa5c4 |
- * I/O intensive workloads which are sensitive to the iterations
|
|
|
4aa5c4 |
- * of the event loop, so avoid the workaround if we know we have
|
|
|
4aa5c4 |
- * new enough glib.
|
|
|
4aa5c4 |
+ * and our workaround coupled with that glib fix started causing leaks, which
|
|
|
4aa5c4 |
+ * surfaced with us not unreferencing the qemu monitor socket in BZ 2045879:
|
|
|
4aa5c4 |
*
|
|
|
4aa5c4 |
- * The function below is used from a header file definition.
|
|
|
4aa5c4 |
+ * https://bugzilla.redhat.com/show_bug.cgi?id=2045879
|
|
|
4aa5c4 |
*
|
|
|
4aa5c4 |
- * Drop when min glib >= 2.64.0
|
|
|
4aa5c4 |
+ * Keeping this wrapper makes it easier to follow with other backports without
|
|
|
4aa5c4 |
+ * conflicts in callers due to the function name change.
|
|
|
4aa5c4 |
*/
|
|
|
4aa5c4 |
-#if GLIB_CHECK_VERSION(2, 64, 0)
|
|
|
4aa5c4 |
void vir_g_source_unref(GSource *src, GMainContext *ctx G_GNUC_UNUSED)
|
|
|
4aa5c4 |
{
|
|
|
4aa5c4 |
g_source_unref(src);
|
|
|
4aa5c4 |
}
|
|
|
4aa5c4 |
-#else
|
|
|
4aa5c4 |
-
|
|
|
4aa5c4 |
-static gboolean
|
|
|
4aa5c4 |
-virEventGLibSourceUnrefIdle(gpointer data)
|
|
|
4aa5c4 |
-{
|
|
|
4aa5c4 |
- GSource *src = data;
|
|
|
4aa5c4 |
-
|
|
|
4aa5c4 |
- g_source_unref(src);
|
|
|
4aa5c4 |
-
|
|
|
4aa5c4 |
- return FALSE;
|
|
|
4aa5c4 |
-}
|
|
|
4aa5c4 |
-
|
|
|
4aa5c4 |
-void vir_g_source_unref(GSource *src, GMainContext *ctx)
|
|
|
4aa5c4 |
-{
|
|
|
4aa5c4 |
- GSource *idle = g_idle_source_new();
|
|
|
4aa5c4 |
-
|
|
|
4aa5c4 |
- g_source_set_callback(idle, virEventGLibSourceUnrefIdle, src, NULL);
|
|
|
4aa5c4 |
-
|
|
|
4aa5c4 |
- g_source_attach(idle, ctx);
|
|
|
4aa5c4 |
-
|
|
|
4aa5c4 |
- g_source_unref(idle);
|
|
|
4aa5c4 |
-}
|
|
|
4aa5c4 |
-
|
|
|
4aa5c4 |
-#endif
|
|
|
4aa5c4 |
--
|
|
|
4aa5c4 |
2.35.1
|
|
|
4aa5c4 |
|