[Xcb] Xlib/XCB in multi-threaded situation results in deadlock

Josh Triplett josh at joshtriplett.org
Wed Dec 1 09:17:04 PST 2010


On Wed, Dec 01, 2010 at 04:29:38PM +0100, Joris Dobbelsteen wrote:
> We have been using DirectFB 1.4.7 with it's X11 backend, which uses
> Xlib/XCB. The DirectFB library performs receiving the input
> (keyboard/mouse) events on a separate thread from the drawing.
> This has resulted in a call to DRI2GetBuffersWithFormat getting stuck,
> while the other thread is trying to receive a mouse event. Once the
> mouse moves the program moves forward for a short while.
> 
> It seems that the drawing thread is suck on the poll and waiting for a
> reply, while the input thread is actually reading data from the socket.
> This causes the above deadlock.

Strange.  Obviously this *shouldn't* happen. :)

> The below patch quickly fabricated here makes the window of opportunity
> for the situation to arise sufficiently small (its not a proper fix!).

Interesting; while not a proper fix, as you said, your patch does help
point at potential culprits.  Thanks!

> Does anyone have a good idea of the causes of this problem and the
> effects it has? I think some in-depth analysis would be in order to
> solve the problem.

Just to confirm, can you provide the exact versions of XCB and of
Xlib that you have?  Xlib 1.4 had some potentially relevant fixes.

- Josh Triplett


More information about the Xcb mailing list