Linux/X11: launcher aborts with xcb_xlib_threads_sequence_lost when starting a profile (screen_resolution_mode=fingerprint)
Environment
- ShardBrowser Launcher 2.1.6 (
.debfrom GitHub Releases) on Ubuntu 22.04.5 LTS, x86_64, glibc 2.35 - X11 session (GNOME Shell on Xorg), single monitor
eDP-1, 1920x1080, scale factor 1 - Engine: bundled
ShardX-Linux(Chromium 158), downloaded on first run - Profile: Linux, screen 1920x1080, SOCKS5 proxy bound
Summary
With the default screen_resolution_mode: "fingerprint", pressing Start on a profile aborts the whole launcher process with an XCB threading assertion. The engine never opens; the launcher window disappears. Repro rate 3/3.
Steps to reproduce
- Install 2.1.6 and start the app with default settings (
~/.config/shardx-launcher/settings.json→"screen_resolution_mode": "fingerprint"). - Create any profile (Linux) and press Start.
- The launcher aborts; no browser window appears.
Actual
[launcher] display: name=Some("eDP-1") physical=1920x1080 scale=1 -> logical=1920x1080
[launcher] display: fingerprint screen=1920x1080
[launcher] display: real 1920x1080 >= fp 1920x1080 — keeping FP screen
[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.
shardbrowser-launcher: ../../src/xcb_io.c:278: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.
Aborted (core dumped)
Expected
The profile starts and the browser window opens.
Workaround
Set "screen_resolution_mode": "real" in ~/.config/shardx-launcher/settings.json and restart the launcher. The same profile then starts normally (verified: engine process running, browser window opened, profile usable).
Analysis / pointer
- The abort happens right after
clamp_screen_to_real_display()logs its decision, and before the engine spawn lines (widevine,QUIC/WebRTC) appear. - In
src-tauri/src/launch.rs(v2.1.6), asyncstart_browser()callscrate::clamp_screen_to_real_display(&w, &mut raw)(if !use_real_screen), which callswindow.primary_monitor()(tao/GTK). On X11 that reaches Xlib from a non-main thread whileXInitThreads()was never called — matching the assertion above. - Because
wants_real_screen()returningtrueskips that branch, the"real"mode avoids the crash. That is consistent with the workaround working.
Impact
Every Linux/X11 user on the default setting cannot start any profile (the launcher dies instead). The app is unusable out of the box on this platform.
Related
- #63 (screen clamp overriding the profile screen at launch) — same function, different symptom.
Extra data
- Crash also occurs with no proxy bound and with the default profile created by the UI (no API involved).
- The machine has one monitor;
primary_monitor()andcurrent_monitor()return the same display. - Happy to test a build with
XInitThreads()called at startup, or with the monitor query moved to the Tauri main thread, if useful.
Follow-up after more testing on the same machine — the "real" workaround is incomplete, root cause confirmed, better workaround found.
-
screen_resolution_mode: "real"only skipsclamp_screen_to_real_display()when all of these hold: the mode isreal, the profile is not mobile, and its screen was not picked by hand. The launcher still aborts with the same XCB assertion for:- Android/phone profiles (
claims_mobile→use_real_screen == false), - profiles with
_meta.screen_custom == true, - and profile create/save in the editor (
profile_save→ the same clamp call).
- Android/phone profiles (
-
The assertion is consistent with Xlib being used from more than one thread without
XInitThreads(). CallingXInitThreads()before anything touches X11 makes the crash disappear. -
Workaround that works (tested 2/2, including a phone profile):
/* xinitthreads.c */ #include <X11/Xlib.h> __attribute__((constructor)) static void init(void) { XInitThreads(); }gcc -shared -fPIC -O2 -o libxinitthreads.so xinitthreads.c -lX11 LD_PRELOAD=/path/to/libxinitthreads.so shardbrowser-launcherWith
screen_resolution_modeback at the default"fingerprint":- Linux profile:
display: real 1920x1080 >= fp 1470x956 — keeping FP screen→ launcher stays alive, CDP ready, browser opens. - Android/phone profile:
display: phone profile — keeping its own screen→ launcher stays alive, CDP ready, browser opens.
- Linux profile:
Suggested fix: call XInitThreads() once at startup on Linux (e.g. at the top of main() before tauri::Builder), or move the primary_monitor() query onto the Tauri main thread. A one-line XInitThreads() is enough on this machine.