Bug 15293 - dbus-launch stuck lock when failing to set address
Summary: dbus-launch stuck lock when failing to set address
Alias: None
Product: dbus
Classification: Unclassified
Component: core (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Havoc Pennington
QA Contact: John (J5) Palmieri
Depends on:
Reported: 2008-03-31 14:23 UTC by Owen Taylor
Modified: 2008-03-31 15:21 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:

Patch ungrabbing on all code paths (1.57 KB, patch)
2008-03-31 14:23 UTC, Owen Taylor
Details | Splinter Review
Patch improving X11 handling (1.60 KB, patch)
2008-03-31 14:44 UTC, Owen Taylor
Details | Splinter Review

Description Owen Taylor 2008-03-31 14:23:07 UTC
Created attachment 15588 [details] [review]
Patch ungrabbing on all code paths

When dbus-launch is run and something has already stored the 
address on the X11 display, it calls XUngrabServer(), then
goes off and runs a non-X11 main loop. This means that the
UngrabServer request is buffered but not actually sent, and
the server remains grabbed forever.

Attached patch fixes by making sure that the XFlush() is called
on all code paths.
Comment 1 Colin Walters 2008-03-31 14:30:22 UTC
This sounds reasonable, though I'm frightened of actually opening up the dbus-launch.c file.

One thing that might be worth considering is some explicit way for a second dbus-session program to override the first.
Comment 2 Owen Taylor 2008-03-31 14:44:39 UTC
Created attachment 15589 [details] [review]
Patch improving X11 handling

Turns out that I was slightly wrong when I said "then
goes off and runs a non-X11 main loop". What it does instead is
go off and run the X11-including main loop, but that loop is 
slightly buggy in that it doesn't check for events *before* selecting.

I'll attach a patch to fix that, though I think it makes no practical
difference here. But if someone cuts-and-pastes the code, or extends
dbus-launch they could get caught.

I'd recommend applying both patches, though either by themselves would
fix the problem.
Comment 3 Colin Walters 2008-03-31 15:21:06 UTC
Both patches applied.

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.