Created attachment 79966 [details] [PATCH] Use GOnce for interface type registration In certain cases, randomly, udisksd was failing with the following messages: > (udisksd:10020): GLib-GObject-WARNING **: cannot register existing type `PolkitSubject' > (udisksd:10020): GLib-GObject-CRITICAL **: g_type_interface_add_prerequisite: assertion `G_TYPE_IS_INTERFACE (interface_type)' failed > (udisksd:10020): GLib-GObject-WARNING **: invalid cast from `PolkitSystemBusName' to `<invalid>' > (udisksd:10020): GLib-GObject-WARNING **: cannot register existing type `PolkitSubject' > (udisksd:10020): GLib-GObject-WARNING **: cannot register existing type `PolkitSubject' > (udisksd:10020): GLib-GObject-CRITICAL **: g_type_interface_add_prerequisite: assertion `G_TYPE_IS_INTERFACE (interface_type)' failed > (udisksd:10020): GLib-GObject-CRITICAL **: g_type_interface_add_prerequisite: assertion `G_TYPE_IS_INTERFACE (interface_type)' failed > ** (udisksd:10020): CRITICAL **: polkit_authority_check_authorization_sync: assertion `POLKIT_IS_SUBJECT (subject)' failed > ** (udisksd:10020): CRITICAL **: polkit_authority_check_authorization_sync: assertion `POLKIT_IS_SUBJECT (subject)' failed Further debugging showed missing locking in polkit_subject_get_type() and potential race explaining the first GObject warning. The attached patch makes the type registration use modern conventions with GOnce.
Looks good. I amended the patch to include a link back to this bug. http://cgit.freedesktop.org/polkit/commit/?id=20ad116a6582e57d20f9d8197758947918753a4c
I can confirm that this patch fixes my reproducable udisksd crashes.
Nice catch guys, thanks for fixing this!
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.