gamescope icon indicating copy to clipboard operation
gamescope copied to clipboard

gamescope-session: xwm: X11 I/O error during session close when Steam has been running for 50+ seconds

Open stinga11 opened this issue 4 months ago • 1 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Are you using any gamescope patches or a forked version of gamescope?

  • [x] The issue occurs on upstream gamescope without any modifications

Current Behavior

When closing a gamescope-session (switching to desktop) after Steam has been running for approximately 50+ seconds with content loaded, gamescope crashes with xwm: X11 I/O error! This is fatal. Aborting... instead of closing cleanly.

The crash is triggered by gamescope's Xwayland auto-recovery logic: when the session close sequence starts, something causes Xwayland to lose its connection, gamescope detects this and attempts to restart Xwayland (server.c:217), but the new Xwayland instance cannot connect to the Wayland server (which is already shutting down), causing gamescope-xwm to abort with SIGABRT.

IMPORTANT: This crash does NOT occur when the session is closed shortly after startup (~25 seconds). It only occurs consistently when Steam has been running with content loaded for 50+ seconds, suggesting it is related to the amount of state accumulated by gamescope during a real session.

Steps To Reproduce

  1. Boot into gamescope-session (embedded mode, DRM/KMS)
  2. Wait for Steam to fully load (Big Picture mode)
  3. Let Steam run for at least 50 seconds with some content loaded
  4. Switch to desktop session (trigger gamescope-session close)

Hardware information

- Distro: Fedora 44
- CPU: AMD Zen 5 (6 cores)
- GPU: AMD RX 7800 XT (RDNA3) — amdgpu open source driver
- Driver: Mesa (open source, no proprietary components)
- Kernel: kernel-blu (Fedora COPR, based on upstream stable)

Software information

- Gamescope version: gamescope-3.16.25-1.fc44.x86_64
- Gamescope launch mode: embedded (DRM/KMS, gamescope-session via systemd user units)
- Display Manager: plasmalogin (plasma-login-manager)
- Session switching: custom session-switcher binary calling
  `systemctl --user stop gamescope-session.target`

Which gamescope backends have the issue you are reporting?

  • [ ] Wayland (default for nested gamescope)
  • [x] DRM (default for embedded gamescope, i.e. gamescope-session)
  • [ ] SDL
  • [ ] OpenVR

Logging, screenshots, or anything else

OBSERVED RESULT:

[gamescope] [Info]  wlserver: [xwayland/server.c:217] Restarting Xwayland
[gamescope] [Info]  wlserver: [xwayland/server.c:217] Restarting Xwayland
[gamescope] [Info]  wlserver: [xwayland/server.c:107] Starting Xwayland on :0
[gamescope] [Info]  wlserver: [xwayland/server.c:107] Starting Xwayland on :1
[gamescope] [Error] xwm: X11 I/O error! This is fatal. Aborting...
gamescope-session.service: Main process exited, code=dumped, status=6/ABRT
gamescope-session.service: Failed with result 'core-dump'.
(EE) could not connect to wayland server

EXPECTED RESULT: gamescope-session closes cleanly with Stopped gamescope-session.service and exit code 0, as it does when the session is closed shortly after startup.


ADDITIONAL CONTEXT:

When the session is closed after only ~25 seconds of runtime, the close is clean:

[gamescope] [Error] drm: drmModeRmFB failed: Bad file descriptor  ← cosmetic only
Stopped gamescope-session.service - Gamescope Session.            ← clean exit ✅

The drmModeRmFB errors are cosmetic and do not cause a crash. The crash only appears when the Xwayland restart loop is triggered during shutdown, which only happens with longer sessions.

stinga11 avatar Jul 27 '26 02:07 stinga11

Can confirm this on a different distro/GPU (CachyOS/Omarchy 4.0.2, kernel 7.2.3-1-cachyos, gamescope 3.16.25-1 — same version as OP, wrapped by gamescope-session-cachyos 1.1.6-1; AMD Strix Point iGPU, "Radeon 890M", amdgpu driver — vs. OP's Fedora + RX 7800 XT). Same crash signature, same log lines exactly, reproduced 3/3 times the same day (session runtimes ~18-80s, so roughly in the same "past the ~25s clean-close window" range OP described).

Symbolized the xwm thread from coredumpctl (via debuginfod.archlinux.org for libX11/libc; gamescope itself ships no debug symbols):

_XIOError → abort()   [inside XPending(), waiting on the X server connection]

Matches xwm: X11 I/O error! This is fatal. Aborting... exactly — consistent with OP's read of the Xwayland-restart-during-shutdown race.

One thing not yet in this thread: this crash leaves real, persistent display state corrupted beyond the failed clean exit. My setup is a handheld with a secondary external monitor (DP-1, connected over DisplayPort) alongside the built-in panel. The gamescope invocation explicitly targets only the built-in panel (-O '*,eDP-1' in the command line from coredumpctl info), but gamescope's own startup log still probes/logs EDID colorimetry for both connected outputs. After the crash, the external monitor comes back from the crashed session with colors extremely oversaturated (consistent with a connector left marked for a wider color gamut/HDR than the SDR content actually being sent). This survives, in order, all of:

  • a Hyprland-side output disable/re-enable (full modeset)
  • DPMS off/on
  • a physical power-cycle of the external monitor itself
  • changing the monitor's own DDC/CI picture-mode preset
  • logging out of the desktop session and back in (fresh DRM master acquisition)

Only a full system reboot clears it — pointing at state left behind at the amdgpu kernel driver level, not just a userspace/session-scoped artifact, and not something the desktop compositor (Hyprland here) can reasonably be expected to reset on its own since it never touched that connector's color state in the first place. So the blast radius of this crash isn't limited to "the systemd unit doesn't report a clean exit" — on a multi-monitor system it can corrupt display state on an output gamescope wasn't even rendering to, in a way that outlives the graphical session.

Happy to attach the full coredumpctl info output or try anything that would help narrow down the Xwayland-restart race if useful.


Filed by Claude Sonnet 5 via Claude Code.

isaac30503 avatar Sep 04 '26 18:09 isaac30503