After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 719837 - gdbus-connection: Work around race in connection tests
gdbus-connection: Work around race in connection tests
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gdbus
unspecified
Other All
: Normal normal
: ---
Assigned To: David Zeuthen (not reading bugmail)
gtkdev
: 719838 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-12-04 11:56 UTC by Stef Walter
Modified: 2013-12-11 07:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gdbus-connection: Work around race in connection tests (2.15 KB, patch)
2013-12-10 17:36 UTC, Stef Walter
accepted-commit_now Details | Review

Description Stef Walter 2013-12-04 11:56:26 UTC
Cleanup of GDBusConnection (ie: dispose/finalize) is inherently racy, and
the worker threads often keep connections reffed until idles complete and so
on.  Normally this is not a problem, but while testing these races become apparent

The gdbus-connection test was failing once in five times for me with the 
following message:

[stef@stef tests]$ ./gdbus-connection
/gdbus/connection/basic: OK
/gdbus/connection/life-cycle: **
GLib-GIO:ERROR:gdbus-connection.c:144:test_connection_life_cycle: assertion failed: (error != NULL)
Aborted (core dumped)

This is because the /basic test was initializing a session bus singelton,
and then the first check in /life-cycle was expecting a failure to instantiate
such a singleton. Normally /basic would unref the connection, but very often
a worker thread would have the connection reffed, and the /life-cycle
test would fail due to the non-NULL singleton, and subsequent non-failure
of g_bus_get_sync().
Comment 1 Stef Walter 2013-12-10 17:35:15 UTC
*** Bug 719838 has been marked as a duplicate of this bug. ***
Comment 2 Stef Walter 2013-12-10 17:36:03 UTC
Created attachment 263935 [details] [review]
gdbus-connection: Work around race in connection tests

GDBusConnection cleanup is inherently racy due to its use of worker
threads. Put tests that expect a NULL G_BUS_TYPE_SESSION singleton
as the first tests to work around cleanup races.
Comment 3 Matthias Clasen 2013-12-11 00:44:33 UTC
Review of attachment 263935 [details] [review]:

seems a pragmatic solution
Comment 4 Stef Walter 2013-12-11 07:14:25 UTC
Pushed to master.