xwayland-satellite: fatal runtime error: stack overflow in xcb load_cursor

built from latest commit

❯ cargo run
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.04s
     Running `target/debug/xwayland-satellite`
 2025-02-22T14:38:36.148Z INFO  xwayland_process > _XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
 2025-02-22T14:38:36.148Z INFO  xwayland_process > _XSERVTransMakeAllCOTSServerListeners: server already running
 2025-02-22T14:38:36.227Z INFO  xwayland_process > The XKEYBOARD keymap compiler (xkbcomp) reports:
 2025-02-22T14:38:36.227Z INFO  xwayland_process > > Warning:          Could not resolve keysym XF86RefreshRateToggle
 2025-02-22T14:38:36.227Z INFO  xwayland_process > > Warning:          Could not resolve keysym XF86Accessibility
 2025-02-22T14:38:36.227Z INFO  xwayland_process > > Warning:          Could not resolve keysym XF86DoNotDisturb
 2025-02-22T14:38:36.227Z INFO  xwayland_process > Errors from xkbcomp are not fatal to the X server
 2025-02-22T14:38:36.231Z INFO  xwayland_satellite::xstate > xfixes version: 1.0

thread 'main' has overflowed its stack
fatal runtime error: stack overflow
zsh: IOT instruction (core dumped)  cargo run
❯ cargo run -- :12
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.03s
     Running `target/debug/xwayland-satellite ':12'`
 2025-02-22T14:38:46.701Z INFO  xwayland_process > The XKEYBOARD keymap compiler (xkbcomp) reports:
 2025-02-22T14:38:46.702Z INFO  xwayland_process > > Warning:          Could not resolve keysym XF86RefreshRateToggle
 2025-02-22T14:38:46.702Z INFO  xwayland_process > > Warning:          Could not resolve keysym XF86Accessibility
 2025-02-22T14:38:46.702Z INFO  xwayland_process > > Warning:          Could not resolve keysym XF86DoNotDisturb
 2025-02-22T14:38:46.702Z INFO  xwayland_process > Errors from xkbcomp are not fatal to the X server
 2025-02-22T14:38:46.712Z INFO  xwayland_satellite::xstate > xfixes version: 1.0

thread 'main' has overflowed its stack
fatal runtime error: stack overflow
zsh: IOT instruction (core dumped)  cargo run -- :12

with:

❯ Xwayland -version
The X.Org Foundation Xwayland Version 24.1.5 (12401005)
X Protocol Version 11, Revision 0

and Hyprland 0.47.2 .

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Okay I think I have found the root problem after finding this Reddit thread: https://www.reddit.com/r/qtools/comments/10g7vf5/rofi_gives_me_segmentation_fault_when_trying_to/ Turns out when xcb-util-cursor’s open_cursor_file tries to load the default cursor theme as you’re doing here: https://github.com/Supreeeme/xwayland-satellite/blob/da2ecb5be816de35e2efe23a408a1c49fe8b11ba/src/xstate/mod.rs#L200-L208 it will try to read either /usr/share/icons/default/* or ~/.local/share/icons/default/* but when those are not present, it will read ~/.icons/default/index.theme (see below)

So to fix this one can just symlink some xcursor theme folder to ~/.local/share/icons/default/ and it stops crashing and then X apps work fine 👍

The xcb-util-cursor source can be found here: https://github.com/freedesktop-unofficial-mirror/xcb__util-cursor/blob/8eb844d39a06f42019dede515c70e7a0b155357d/cursor/load_cursor.c#L117

Now, believe it or not, after poking around, the root cause seems to be this issue: https://github.com/nwg-piotr/nwg-look/issues/90 where nwg-look, which is part of nwg-shell, generates the following faulty index.theme config file:

# This file is written by nwg-look. Do not edit.
[Icon Theme]
Name=Default
Comment=Default Cursor Theme
Inherits=default

As the default theme generated here only has the index.theme file, this triggers the _XcursorThemeInherits (just above open_cursor_file) mechanism, which will return the path to the inherited cursor theme on missing entries (which is all in this case), which is…the same file, leading to the recursive call chain in xcb-util-cursor as seen here (the first arg is just the xcb_cursor_context_t*):

xcb_cursor_load_cursor(0x55c8aa8e5970, left_ptr)
open_cursor_file(0x55c8aa8e5970, default, left_ptr, -1)
_XcursorThemeInherits(/home/janis/.icons/default/index.theme) -> default
open_cursor_file(0x55c8aa8e5970, default, left_ptr, -1)
_XcursorThemeInherits(/home/janis/.icons/default/index.theme) -> default
open_cursor_file(0x55c8aa8e5970, default, left_ptr, -1)
_XcursorThemeInherits(/home/janis/.icons/default/index.theme) -> default
open_cursor_file(0x55c8aa8e5970, default, left_ptr, -1)
_XcursorThemeInherits(/home/janis/.icons/default/index.theme) -> default
open_cursor_file(0x55c8aa8e5970, default, left_ptr, -1)
...

Now I wasn’t able to trace how that nwg-look file was installed (as it is quite old considering the issue was opened in march and I haven’t installed sway, so if it’s not niri or xwayland-satellite maybe Hyprland?) but to fix that replacing Inherits=default with Inherits=Adwaita is now the default behavior for nwg-look.

Anyway this doesn’t seem to be your problem so you can probably close this issue (although maybe checking if it’s one of your dependencies and evtl. updating that?).