[gnome-control-center/benzea/misc-sanitiser-issues] tests: Avoid thread race by keeping GDBusConnection around
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/benzea/misc-sanitiser-issues] tests: Avoid thread race by keeping GDBusConnection around
- Date: Thu, 7 May 2020 15:42:31 +0000 (UTC)
commit f551003839d5bfad7513a291013623eaa7d2124a
Author: Benjamin Berg <bberg redhat com>
Date: Thu May 7 17:31:42 2020 +0200
tests: Avoid thread race by keeping GDBusConnection around
Seems like we get (possibly false) reports from inside GLib when
unref'ing/ref'ing the GDBusConnection quickly between tests.
Avoid that by keeping a reference around.
6161 WARNING: ThreadSanitizer: data race (pid=3504)
6162 Write of size 8 at 0x7b040001d240 by thread T34:
6163 #0 free <null> (libtsan.so.0+0x360d5)
6164 #1 g_free <null> (libglib-2.0.so.0+0x58a6c)
6165 Previous read of size 1 at 0x7b040001d243 by main thread:
6166 #0 memcpy <null> (libtsan.so.0+0x424c3)
6167 #1 g_strdup <null> (libglib-2.0.so.0+0x72cb1)
6168 #2 fixture_set_up_empty ../tests/network/test-network-panel.c:66 (test-network-panel+0x41f892)
6169 #3 <null> <null> (libglib-2.0.so.0+0x7b2b1)
6170 #4 __libc_start_main <null> (libc.so.6+0x27041)
6171 Thread T34 'gdbus' (tid=3539, running) created by main thread at:
6172 #0 pthread_create <null> (libtsan.so.0+0x5ec29)
6173 #1 <null> <null> (libglib-2.0.so.0+0xa0f88)
6174 #2 fixture_set_up_empty ../tests/network/test-network-panel.c:66 (test-network-panel+0x41f892)
6175 #3 <null> <null> (libglib-2.0.so.0+0x7b2b1)
6176 #4 __libc_start_main <null> (libc.so.6+0x27041)
6177 SUMMARY: ThreadSanitizer: data race (/lib64/libtsan.so.0+0x360d5) in __interceptor_free
tests/network/test-network-panel.c | 9 +++++++++
1 file changed, 9 insertions(+)
---
diff --git a/tests/network/test-network-panel.c b/tests/network/test-network-panel.c
index 1f89e2187..183b2c9f3 100644
--- a/tests/network/test-network-panel.c
+++ b/tests/network/test-network-panel.c
@@ -646,6 +646,8 @@ test_vpn_sorting (NetworkPanelFixture *fixture,
int
main (int argc, char **argv)
{
+ g_autoptr(GDBusConnection) bus = NULL;
+ g_autoptr(GError) error = NULL;
g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
g_setenv ("LIBNM_USE_SESSION_BUS", "1", TRUE);
g_setenv ("LC_ALL", "C", TRUE);
@@ -653,6 +655,13 @@ main (int argc, char **argv)
gtk_test_init (&argc, &argv, NULL);
hdy_init (&argc, &argv);
+ /* FIXME: This keeps hold of the GBus object. The only reason is that
+ * there seems to be a race condition in GLib when destroying
+ * and recreating it. */
+ bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
+ if (!bus)
+ g_error ("Could not get session bus: %s", error->message);
+
g_test_add ("/network-panel-wired/empty-ui",
NetworkPanelFixture,
NULL,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]