Bug 65130 - Race condition in GObject interface type registration
Summary: Race condition in GObject interface type registration
Status: RESOLVED FIXED
Alias: None
Product: PolicyKit
Classification: Unclassified
Component: libpolkit (show other bugs)
Version: unspecified
Hardware: All Linux (All)
: medium major
Assignee: David Zeuthen (not reading bugmail)
QA Contact: David Zeuthen (not reading bugmail)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-29 13:58 UTC by Tomas Bzatek
Modified: 2013-05-29 19:23 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
[PATCH] Use GOnce for interface type registration (3.77 KB, text/plain)
2013-05-29 13:58 UTC, Tomas Bzatek
Details

Description Tomas Bzatek 2013-05-29 13:58:38 UTC
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.
Comment 1 Colin Walters 2013-05-29 14:14:34 UTC
Looks good.  I amended the patch to include a link back to this bug.

http://cgit.freedesktop.org/polkit/commit/?id=20ad116a6582e57d20f9d8197758947918753a4c
Comment 2 Hans de Goede 2013-05-29 14:34:40 UTC
I can confirm that this patch fixes my reproducable udisksd crashes.
Comment 3 David Zeuthen (not reading bugmail) 2013-05-29 19:23:34 UTC
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.