r44353 - in /desktop/experimental/glib2.0/debian: changelog patches/gdbus-peer-test-let-GDBusServer-start-before-notifyi.patch patches/series

smcv at users.alioth.debian.org smcv at users.alioth.debian.org
Mon May 11 19:11:27 UTC 2015


Author: smcv
Date: Mon May 11 19:11:26 2015
New Revision: 44353

URL: http://svn.debian.org/wsvn/pkg-gnome/?sc=1&rev=44353
Log:
d/p/gdbus-peer-test-let-GDBusServer-start-before-notifyi.patch: add patch fixing a race condition in the gdbus-peer test. Applied upstream for 2.45.2.

Added:
    desktop/experimental/glib2.0/debian/patches/gdbus-peer-test-let-GDBusServer-start-before-notifyi.patch
Modified:
    desktop/experimental/glib2.0/debian/changelog
    desktop/experimental/glib2.0/debian/patches/series

Modified: desktop/experimental/glib2.0/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/experimental/glib2.0/debian/changelog?rev=44353&op=diff
==============================================================================
--- desktop/experimental/glib2.0/debian/changelog	[utf-8] (original)
+++ desktop/experimental/glib2.0/debian/changelog	[utf-8] Mon May 11 19:11:26 2015
@@ -4,6 +4,9 @@
   * d/p/0001-Fix-trashing-on-overlayfs.patch: add upstream bug reference
   * d/p/0001-glocalfilemonitor-Send-DELETED-event-when-there-is-n.patch:
     add upstream bug reference
+  * d/p/gdbus-peer-test-let-GDBusServer-start-before-notifyi.patch:
+    add patch fixing a race condition in the gdbus-peer test.
+    Applied upstream for 2.45.2.
 
  -- Simon McVittie <smcv at debian.org>  Mon, 11 May 2015 19:32:30 +0100
 

Added: desktop/experimental/glib2.0/debian/patches/gdbus-peer-test-let-GDBusServer-start-before-notifyi.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/experimental/glib2.0/debian/patches/gdbus-peer-test-let-GDBusServer-start-before-notifyi.patch?rev=44353&op=file
==============================================================================
--- desktop/experimental/glib2.0/debian/patches/gdbus-peer-test-let-GDBusServer-start-before-notifyi.patch	(added)
+++ desktop/experimental/glib2.0/debian/patches/gdbus-peer-test-let-GDBusServer-start-before-notifyi.patch	[utf-8] Mon May 11 19:11:26 2015
@@ -0,0 +1,142 @@
+From 6f859fe21a1955ab60ba4aa7e22841c7dbffdea3 Mon Sep 17 00:00:00 2001
+From: Simon McVittie <simon.mcvittie at collabora.co.uk>
+Date: Thu, 7 May 2015 16:45:48 +0100
+Subject: gdbus-peer test: let GDBusServer start before notifying
+ main thread
+
+When running the nonce-tcp and tcp-anonymous tests in one run
+of gdbus-peer, or running one of them twice via command-line options
+"-p /gdbus/tcp-anonymous -p /gdbus/tcp-anonymous", the one run second
+would sometimes fail to connect with ECONNRESET.
+
+Adding more debug messages revealed that in the successful case,
+g_main_loop_run() was executed in the server thread first:
+
+ # tcp-anonymous: server thread: listening on tcp:host=localhost,port=53517
+ # tcp-anonymous: server thread: starting server...
+ # tcp-anonymous: server thread: creating main loop...
+ # tcp-anonymous: server thread: running main loop...
+ # tcp-anonymous: main thread: trying tcp:host=localhost,port=53517...
+ # tcp-anonymous: main thread: waiting for server thread...
+
+but in the failing case, the main thread attempted to connect
+before the call to g_main_loop_run() in the server thread:
+
+ # tcp-anonymous: server thread: listening on tcp:host=localhost,port=40659
+ # tcp-anonymous: server thread: starting server...
+ # tcp-anonymous: server thread: creating main loop...
+ # tcp-anonymous: main thread: trying tcp:host=localhost,port=40659...
+ # tcp-anonymous: server thread: running main loop...
+
+(The log message "creating main loop" was immediately before
+create_service_loop(), and "running main loop" was immediately
+before g_main_loop_run().)
+
+To ensure that the GDBusServer has a chance to start accepting
+connections before the main thread tries to connect to it, do not
+tell the main thread about the service_loop immediately, but instead
+defer it to an idle.
+
+Bug: https://bugzilla.gnome.org/show_bug.cgi?id=749079
+Signed-off-by: Simon McVittie <simon.mcvittie at collabora.co.uk>
+Reviewed-by: Philip Withnall <philip.withnall at collabora.co.uk>
+Applied-upstream: 2.45.2, commit:6f859fe21a1955ab60ba4aa7e22841c7dbffdea3
+---
+ gio/tests/gdbus-peer.c | 41 ++++++++++++++++++++++++++++-------------
+ 1 file changed, 28 insertions(+), 13 deletions(-)
+
+diff --git a/gio/tests/gdbus-peer.c b/gio/tests/gdbus-peer.c
+index 6c6f3b0..2c702ab 100644
+--- a/gio/tests/gdbus-peer.c
++++ b/gio/tests/gdbus-peer.c
+@@ -335,14 +335,34 @@ on_new_connection (GDBusServer *server,
+   return TRUE;
+ }
+ 
+-static void
+-create_service_loop (GMainContext *service_context)
++/* We don't tell the main thread about the new GDBusServer until it has
++ * had a chance to start listening. */
++static gboolean
++idle_in_service_loop (gpointer loop)
+ {
+   g_assert (service_loop == NULL);
+   g_mutex_lock (&service_loop_lock);
+-  service_loop = g_main_loop_new (service_context, FALSE);
++  service_loop = loop;
+   g_cond_broadcast (&service_loop_cond);
+   g_mutex_unlock (&service_loop_lock);
++
++  return G_SOURCE_REMOVE;
++}
++
++static void
++run_service_loop (GMainContext *service_context)
++{
++  GMainLoop *loop;
++  GSource *source;
++
++  g_assert (service_loop == NULL);
++
++  loop = g_main_loop_new (service_context, FALSE);
++  source = g_idle_source_new ();
++  g_source_set_callback (source, idle_in_service_loop, loop, NULL);
++  g_source_attach (source, service_context);
++  g_source_unref (source);
++  g_main_loop_run (loop);
+ }
+ 
+ static void
+@@ -417,8 +437,7 @@ service_thread_func (gpointer user_data)
+ 
+   g_dbus_server_start (server);
+ 
+-  create_service_loop (service_context);
+-  g_main_loop_run (service_loop);
++  run_service_loop (service_context);
+ 
+   g_main_context_pop_thread_default (service_context);
+ 
+@@ -512,8 +531,7 @@ service_thread_func (gpointer data)
+                     data);
+   g_socket_service_start (service);
+ 
+-  create_service_loop (service_context);
+-  g_main_loop_run (service_loop);
++  run_service_loop (service_context);
+ 
+   g_main_context_pop_thread_default (service_context);
+ 
+@@ -1212,8 +1230,7 @@ nonce_tcp_service_thread_func (gpointer user_data)
+ 
+   g_dbus_server_start (server);
+ 
+-  create_service_loop (service_context);
+-  g_main_loop_run (service_loop);
++  run_service_loop (service_context);
+ 
+   g_main_context_pop_thread_default (service_context);
+ 
+@@ -1405,8 +1422,7 @@ tcp_anonymous_service_thread_func (gpointer user_data)
+ 
+   g_dbus_server_start (server);
+ 
+-  create_service_loop (service_context);
+-  g_main_loop_run (service_loop);
++  run_service_loop (service_context);
+ 
+   g_main_context_pop_thread_default (service_context);
+ 
+@@ -1561,8 +1577,7 @@ codegen_service_thread_func (gpointer user_data)
+                     G_CALLBACK (codegen_on_new_connection),
+                     animal);
+ 
+-  create_service_loop (service_context);
+-  g_main_loop_run (service_loop);
++  run_service_loop (service_context);
+ 
+   g_object_unref (animal);
+ 
+-- 
+2.1.4
+

Modified: desktop/experimental/glib2.0/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/experimental/glib2.0/debian/patches/series?rev=44353&op=diff
==============================================================================
--- desktop/experimental/glib2.0/debian/patches/series	[utf-8] (original)
+++ desktop/experimental/glib2.0/debian/patches/series	[utf-8] Mon May 11 19:11:26 2015
@@ -21,3 +21,4 @@
 gdbus-serialization-use-check_serialization-instead-.patch
 0001-Fix-trashing-on-overlayfs.patch
 0001-glocalfilemonitor-Send-DELETED-event-when-there-is-n.patch
+gdbus-peer-test-let-GDBusServer-start-before-notifyi.patch




More information about the pkg-gnome-commits mailing list