Bug 9259 - Deadlock when calling dbus_bus_get() after dbus_g_thread_init() using sudo
Summary: Deadlock when calling dbus_bus_get() after dbus_g_thread_init() using sudo
Status: RESOLVED FIXED
Alias: None
Product: dbus
Classification: Unclassified
Component: GLib (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: high major
Assignee: Rob Taylor
QA Contact: John (J5) Palmieri
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-06 03:26 UTC by Sebastian Dröge (slomo)
Modified: 2007-02-08 15:20 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
test.c (453 bytes, text/plain)
2006-12-06 03:26 UTC, Sebastian Dröge (slomo)
Details

Description Sebastian Dröge (slomo) 2006-12-06 03:26:05 UTC
Hi,
the attached piece of code deadlocks when called via sudo but works fine
otherwise. This is probably caused by DBUS_SESSION_BUS_ADDRESS pointing to a
socket for the session bus of the user calling sudo which is not owned by root.

When using dbus_threads_init_default() or not initializing threads at all it
doesn't deadlock but fails gracefully.

Bye
Comment 1 Sebastian Dröge (slomo) 2006-12-06 03:26:58 UTC
Created attachment 7976 [details]
test.c
Comment 2 Sebastian Dröge (slomo) 2006-12-06 03:27:13 UTC
This is btw with dbus 1.0.1 and dbus-glib 0.72.
Comment 3 Rob Taylor 2006-12-12 06:15:10 UTC
I think J5 mentioned he had a fix for this.
Comment 4 John (J5) Palmieri 2006-12-12 12:17:52 UTC
One workaround is to use dbus_threads_init_default() instead of
dbus_g_threads_init() since the internal thread implementation uses recursive
threading and glib's uses non-recursive.  dbus_g_threads_init should start to
call dbus_threads_init_default() in the future.  We should also fix this code to
work with nonrecursive locks by dropping the lock whenever we call functions
outside of bus.c that may call back into bus.c
Comment 5 Rob Taylor 2007-02-08 15:20:05 UTC
Fixed in git head.


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.