[Xcb] Debug xcb_connect fail

Uli Schlachter psychon at znc.in
Tue Jan 4 15:37:16 UTC 2022


On 23.12.21 10:40, Edgar Mobile wrote:
> I have to debug an EGL app on Ubuntu where xcb_connect occasionally fails for reasons unknown ( DISPLAY is set),

With what error message?

> but I don't have access to the libXCB sourcecode.

See https://lmgtfy.app/?q=libxcb+source+code

> Are there debug envionment falgs or similar that will give me a detailed reason for why it fails?

All errors are printed to stderr. Well, all errors that are printed

One possible reason is that the X11 server rejects the connection. The
code for that is here:

Another possible reason is that no socket to the X11 server can be
opened. There are several possible places in xcb_util.c for this and
which one is the "real error" depends on how you usually connect to the
X11 server.

Hm, this case does not actually print anything. I guess when
xcb_connect() fails with XCB_CONN_ERROR, you'd have to look at errno and
hope that the last connection failure is the important one.


Depending on what your usual transport is, you might have some luck with
only restricting connection attempts to that transport to get the real
errno value in this case. For example, DISPLAY=:0 becomes
DISPLAY=unix/:0 to force the unix transport and DISPLAY=tcp/:0 for tcp.

Who needs a ~/.signature anyway?

More information about the Xcb mailing list