[Xcb] Looking for ways to find a threading issue

Uli Schlachter psychon at znc.in
Thu Nov 14 11:46:41 PST 2013


Hi,

On 14.11.2013 20:21, Clemens Eisserer wrote:
> I am trying to hunt down what seems to be a threading issue in OpenJDK's
> codebase.
> OpenJDK does not call XInitThreads, but instead uses its own locks to
> protect xlib from beeing accessed concurrently, however it seems somewhere
> a call to xlib slips through that lock.

....

> I defined XTHREADS_WARN in xlib, but it didn't spot anything.
> Is there any additional support  for finding this kind of issue in XCB and
> /or Xlib?

XCB is always perfectly thread-safe as soon as it is linked with libpthread, so
this is unlikely to be an issue with XCB at all. However, there could be a
problem if you call into XCB from another thread while

The only thing that I can think of right now: Call XInitThreads() and see if
that fixes the issue. Just to be sure that you are really on the right track.
But I guess you already did that.

Also, I wonder why you can't just call XInitThreads(), but I doubt that I want
to know the answer to this.

> Thank you in advance, Clemens
> 
> The error-message was:
> 
> [xcb] Unknown sequence number while processing queue
> [xcb] Most likely this is a multi-threaded client and XInitThreads has not
> been called
> [xcb] Aborting, sorry about that.
> java: xcb_io.c:274: poll_for_event: Assertion `!xcb_xlib_threads_sequence_
>>
>> lost' failed.
>> Aborted (core dumped)

It's always this message? From a quick look at libX11, this happens if libX11
receives an event with a sequence number that is larger than the last sent
sequence number.

In other words, we have only sent 10 requests to the server, but there is an
event which was generated after request 15 was handled by the server.

Uli
-- 
If you ask me to debug your code, I'm going to mail you spiders.


More information about the Xcb mailing list