GNOME Bugzilla – Bug 719838
gdbus-connection: Work around race in connection tests
Last modified: 2013-12-10 17:35:15 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().
Created attachment 263504 [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. https://bugzilla.gnome.org/show_bug.cgi?id=719837
*** This bug has been marked as a duplicate of bug 719837 ***