Skip to content

dconf_gdbus_get_worker_context(): improve GObject deadlock workaround

Owen Taylor requested to merge otaylor/dconf:gdbus-deadlocks into master

The existing workaround for https://bugzilla.gnome.org/show_bug.cgi?id=674885 doesn't go far enough, and deadlocks can occur, for example, with the GSocket type. Extend the workaround logic to all the types from glib/gio/gdbusprivate.c:ensure_required_types().


The particular reproducer I had was with flatpak - when flatpak starts using libsoup, the GNOME GIO proxy plugin uses GSettings, which uses DConf, which fires off it's worker thread, and starts using GDBus which causes GDBus to initialize all types it considers relevant, including GSocket.

At the same time the libsoup usage in the main thread continues and the class init for SoupSocket runs, which has a property of type GSocket.

This gives us the conditions for causing glib#541 (Formerly known as https://bugzilla.gnome.org/show_bug.cgi?id=674885) - g_type_init(G_TYPE_SOCKET) being called not with the class_init lock on one thread and with the class_init lock on another thread.

Merge request reports