Bug 9259

Summary: Deadlock when calling dbus_bus_get() after dbus_g_thread_init() using sudo
Product: dbus Reporter: Sebastian Dröge (slomo) <slomo>
Component: GLibAssignee: Rob Taylor <rob.taylor>
Status: RESOLVED FIXED QA Contact: John (J5) Palmieri <johnp>
Severity: major    
Priority: high    
Version: unspecified   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: test.c

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.