[Xcb] libxcb/libX11 deadlocking and asserting in multi-threaded use

Nicholas Allen nick.allen at onlinehome.de
Fri Mar 19 00:46:09 PDT 2010

After looking into this a bit more I'm now pretty sure this is a bug in
libX11/XCB. I have a simple test program that can now be switched
between running in multi-threaded or in single threaded mode. It works
perfectly in single threaded mode (where events are handled directly on
the X11 event dispatch thread) but in multi-threaded mode it is randomly
crashing and locking up (even though XInitThreads is called as first thing).

It's a little hard to post the example code here as we are writing a
windowing system abstraction in Java that uses JNI. I'll try to rewrite
it as a pure C program with the minimal amount of code to reproduce the
problem and post it to the list.


Nicholas Allen

Nicholas Allen wrote:
> Hi,
> We have a multi-threaded app that often deadlocks inside libx11 code
> (XNextEvent never returns). We've initialized threading support by
> calling XInitThreads as the very first thing we do. We have no other
> mutexes in use in our code so it seems that the error is within
> libX11/xcb itself and not our own code.
> When the app doesn't lock (very rarely) then after a short time we get
> this assertion:
> ../../src/xcb_io.c:242: process_responses: Assertion `(((long)
> (dpy->last_request_read) - (long) (dpy->request)) <= 0)' failed.
> Aborted
> and the application aborts. We are using Ubuntu Karmic on 64-bit
> machine. In Jaunty we never experienced any problems but since the
> upgrade the problems are very apparent. This further convinces me that
> the problem is more likely in libX11/XCB than our own code. Has anyone
> else noticed these deadlock issues? Are there any workarounds? Were
> there any bug fixes that could have addressed issues like this?
> I will be happy to provide more information if needed and to help with
> debugging and fixing xlib if needed.
> Many thanks in advance,
> Nicholas Allen
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb

More information about the Xcb mailing list