We are seeing frequent triggering of an assert inside libX11 in xcb_io.c, such as:
[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.
firefox: ../../src/xcb_io.c:259: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.
This appears to be a race condition when libX11 gets used from multiple threads, regardless if XLockDisplay is called. More details about how the actual race here: https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/34
According to the release announcement for 1.7.0, it appears that fix was merged for release in that 1.7.0: https://lists.x.org/archives/xorg-announce/2020-November/003065.html
Seems like Ubuntu 20 and below are still using an older version of libX11 (1.6.9) which does not have this fix. So we will still see this crash on CI, because we are only using Ubuntu 18.04 there.
The main user of libX11 is GDK/GTK, which is where we tend to see the crashing thread from the assert. If you look in the other threads at time of crash you will usually see something calling into libxcb. Other threads that use libxcb/libX11 that get us into trouble include: WebRender sometimes making GLX requests from inside Mesa, RenderCompositorSWGL using XCB, GtkVsyncSource using GLX calls, etc.
I am not as of yet sure there is a great fix for this issue other than encouraging users to upgrade to libX11 1.7.0 or later, or try Wayland. Incidence of crashes still seems low enough that maybe this is not that bad.