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

Joris Dobbelsteen joris.dobbelsteen at sioux.eu
Thu Dec 2 02:05:28 PST 2010


On Wed, 2010-12-01 at 09:17 -0800, Josh Triplett wrote:
> 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.

libxcb 1.7
libX11 1.4
xcb-proto 1.6
xcb-util 0.3.6
xorg-server 1.9.2

and loads more X libraries. I'll provide them on popular request.

> - Josh Triplett
> 




More information about the Xcb mailing list