From 4043c332a00ee2a795192c2dc2abeef05be528a7 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Tue, 14 Dec 2010 12:47:29 +0000 Subject: [PATCH] Fix unref of GSource objects to address performance degradation --- gtk-vnc-0.4.2-source-unref.patch | 42 ++++++++++++++++++++++++++++++++ gtk-vnc.spec | 7 +++++- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 gtk-vnc-0.4.2-source-unref.patch diff --git a/gtk-vnc-0.4.2-source-unref.patch b/gtk-vnc-0.4.2-source-unref.patch new file mode 100644 index 0000000..c644469 --- /dev/null +++ b/gtk-vnc-0.4.2-source-unref.patch @@ -0,0 +1,42 @@ +commit 968968c9cf705f5bc96764399ea17a27a454c1c5 +Author: Daniel P. Berrange +Date: Tue Dec 14 12:41:01 2010 +0000 + + Fix leak of GSource objects which causes performance problems + + The GLib event loop scales poorly as the number of GSource objects + increases. A missing unref on the GSource objects used in the VNC + connection meant that many unused instances accumulated, slowing + down the event loop processing. + + * src/vncconnection.c: Unref all GSource objects + +diff --git a/src/vncconnection.c b/src/vncconnection.c +index 165a5f1..51b8b8d 100644 +--- a/src/vncconnection.c ++++ b/src/vncconnection.c +@@ -234,6 +234,7 @@ static GIOCondition g_io_wait(GSocket *sock, GIOCondition cond) + g_source_set_callback(src, (GSourceFunc)g_io_wait_helper, coroutine_self(), NULL); + g_source_attach(src, NULL); + ret = coroutine_yield(NULL); ++ g_source_unref(src); + return *ret; + } + +@@ -254,6 +255,7 @@ static GIOCondition g_io_wait_interruptable(struct wait_queue *wait, + id = g_source_attach(src, NULL); + wait->waiting = TRUE; + ret = coroutine_yield(NULL); ++ g_source_unref(src); + wait->waiting = FALSE; + + if (ret == NULL) { +@@ -334,6 +336,8 @@ static gboolean g_condition_wait(g_condition_wait_func func, gpointer data) + g_source_attach(src, NULL); + g_source_set_callback(src, g_condition_wait_helper, coroutine_self(), NULL); + coroutine_yield(NULL); ++ g_source_unref(src); ++ + return TRUE; + } + diff --git a/gtk-vnc.spec b/gtk-vnc.spec index 0684812..b210ba9 100644 --- a/gtk-vnc.spec +++ b/gtk-vnc.spec @@ -18,7 +18,7 @@ Summary: A GTK2 widget for VNC clients Name: gtk-vnc Version: 0.4.2 -Release: 3%{?dist}%{?extra_release} +Release: 4%{?dist}%{?extra_release} License: LGPLv2+ Group: Development/Libraries Source: http://ftp.gnome.org/pub/GNOME/sources/%{name}/0.4/%{name}-%{version}.tar.bz2 @@ -26,6 +26,7 @@ Patch1: %{name}-%{version}-motion-event-crash.patch Patch2: %{name}-%{version}-tls-shutdown-crash.patch Patch3: %{name}-%{version}-framebuffer-update-bounds-check.patch Patch4: %{name}-%{version}-pixmap-cache.patch +Patch5: %{name}-%{version}-source-unref.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) URL: http://live.gnome.org/gtk-vnc BuildRequires: gtk2-devel >= 2.14 @@ -154,6 +155,7 @@ cd %{name}-%{version} %patch2 -p1 %patch3 -p1 %patch4 -p1 +%patch5 -p1 cd .. %if %{with_gtk3} cp -a gtk-vnc-%{version} gtk-vnc2-%{version} @@ -299,6 +301,9 @@ rm -fr %{buildroot} %changelog +* Tue Dec 14 2010 Daniel P. Berrange - 0.4.2-4 +- Fix unref of GSource objects to address performance degradation (rhbz #657847) + * Mon Nov 29 2010 Daniel P. Berrange - 0.4.2-3 - Re-introduce a server side pixmap via cairo to cache framebuffer (rhbz #657542)