Bug 501381 - Unity Engine games launched with -force-wayland quit immediately.
Summary: Unity Engine games launched with -force-wayland quit immediately.
Status: RESOLVED WORKSFORME
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 6.3.2
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-11 23:56 UTC by Jean-Luc
Modified: 2025-04-11 03:47 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Luc 2025-03-11 23:56:26 UTC
SUMMARY
Attempting to launch a Unity Engine game with `-force-wayland` on engine versions that support it as an experimental feature fails, with Kwin rejecting the client connection soon after the game launches. The game will often coredump after this point in libglapi.so (Backtrace from the Unity game itself and journalctl attached, I removed the name of the game as it's a project I have in development that I'd rather not leak details of yet)

kwin_wayland[960]: kwin_core: Cannot grant a token to KWin::ClientConnection(0x558552dc3a90)
Mar 12 09:39:15 Kirby-MkV-Arch kwin_wayland_wrapper[960]: error in client communication (pid 5394)
Mar 12 09:39:15 Kirby-MkV-Arch systemd-coredump[5462]: Process 5394 (<game name removed>) of user 1000 terminated abnormally with signal 11/SEGV, processing...
Mar 12 09:39:16 Kirby-MkV-Arch systemd-coredump[5463]: [🡕] Process 5394 (<Game name removed>) of user 1000 dumped core.
                                                       Module [dso] without build-id.
                                                       Module [dso] without build-id.
                                                       Module [dso] without build-id.
                                                       Module libglapi.so.0 without build-id.
                                                       Stack trace of thread 5394:
                                                       #0  0x00007f520aec26db n/a (n/a + 0x0)
                                                       ELF object binary architecture: AMD x86-64

STEPS TO REPRODUCE
1. Obtain a native Linux build of any Unity Engine game using Unity 2023.1.x or higher (game in question that crashed here is on Unity 6000.0.38f1)
2. Attempt to launch said game in the Terminal with -force-wayland as a command line argument.
3. Observe Kwin throwing an error and refusing to grant a token to the Unity game with `journalctl -f`

OBSERVED RESULT
Game immediately quits, sometimes also coredumping, but not every time.

EXPECTED RESULT
Game launches as it would normally via Xwayland without command line arguments.

SOFTWARE/OS VERSIONS
Linux: 6.12.13-273-tkg-eevdf, Arch Linux
KDE Plasma Version: 6.3.2
KDE Frameworks Version: 6.11
Qt Version: 6.8.2

ADDITIONAL INFORMATION
I attempted the reproduction steps on another Wayland compositor (labwc, aka. wlroots-based) and Unity Engine game in question launched normally. I am happy to provide a build of the game in question if the KDE devs aren't able to obtain a game to test with that meets the reproduction steps' criteria.
Comment 1 Zamundaaa 2025-03-12 00:13:53 UTC
"Cannot grant a token to ..." means that the app requested an activation token, but isn't focused and thus doesn't get a valid token. It's a harmless warning - but it's somewhat likely that the app is doing something wrong with activation.

"error in client communication" means that the app crashed, or got killed by a protocol error. If it's a protocol error, please check the logging from the application, it'll be printed in there. If it's a crash, well, that's very obviously a bug in the app.
Comment 2 Jean-Luc 2025-03-12 00:17:36 UTC
(In reply to Zamundaaa from comment #1)
> "Cannot grant a token to ..." means that the app requested an activation
> token, but isn't focused and thus doesn't get a valid token. It's a harmless
> warning - but it's somewhat likely that the app is doing something wrong
> with activation.
> 
> "error in client communication" means that the app crashed, or got killed by
> a protocol error. If it's a protocol error, please check the logging from
> the application, it'll be printed in there. If it's a crash, well, that's
> very obviously a bug in the app.

While it works with labwc, I do see some weird logging in the game's Player.log (retrieved from the persistentDataPath set by Unity):
requesting resize 1920 x 1080
Using native desktop resolution 1920 x 1080
requesting fullscreen 1920 x 1080 at 0/1 Hz
Desktop is 1920 x 1080 @ 120 Hz
InitializeOrResetSwapChain 1920x1080 hdr=0 samples=1
Disable old input system
UnloadTime: 0.115430 ms
requesting resize 1920 x 1080
Using native desktop resolution 1920 x 1080
warning: queue 0x16a998a0 destroyed while proxies still attached:
  wp_presentation_feedback#64 still attached
[destroyed object]: error 0: surface already exists
requesting fullscreen 1920 x 1080 at 120/1 Hz
Desktop is 1920 x 1080 @ 120 Hz
InitializeOrResetSwapChain 1920x1080 hdr=0 samples=1
[Physics::Module] Cleanup current backned.
[Physics::Module] Id: 0xf2b8ea05
Input System module state changed to: ShutdownInProgress.
Input System polling thread exited.
Input System module state changed to: Shutdown.
Vulkan PSO: data extracted [new size=3228144, old size=3228144, incomplete=0]
Vulkan PSO: Pipeline cache has not changed skipping save handle[15cbbb30]
warning: queue 0x15ffdd60 destroyed while proxies still attached:
  wl_callback#34 still attached
  wl_surface#33 still attached

I'll report this to Unity.
Comment 3 Jean-Luc 2025-03-12 00:18:23 UTC
A second log in the Segfaulting case: 

requesting resize 1920 x 1080
Using native desktop resolution 1920 x 1080
requesting fullscreen 1920 x 1080 at 0/1 Hz
Desktop is 1920 x 1080 @ 120 Hz
InitializeOrResetSwapChain 1920x1080 hdr=0 samples=1
Disable old input system
UnloadTime: 0.130950 ms
Found settings file, loading it.
Player's save loaded successfully.
warning: queue 0x1ea6b130 destroyed while proxies still attached:
  wp_presentation_feedback#64 still attached
[destroyed object]: error 0: surface already exists
requesting resize 1920 x 1080
Using native desktop resolution 1920 x 1080
requesting fullscreen 1920 x 1080 at 120/1 Hz
Desktop is 1920 x 1080 @ 120 Hz
InitializeOrResetSwapChain 1920x1080 hdr=0 samples=1
Received signal SIGSEGV (11) - code:1 errno:0 addr:0x100000088
Obtained 18 stack frames.
#0  0x007f5209553cd0 in (Unknown)
#1  0x007f520aec26db in (Unknown)
#2  0x007f520aeedbc7 in (Unknown)
#3  0x007f520af42ff2 in (Unknown)
#4  0x007f520af34e74 in (Unknown)
#5  0x007f520af327c7 in (Unknown)
#6  0x007f520af2f54e in (Unknown)
#7  0x007f520af2c615 in (Unknown)
#8  0x007f520ab91214 in (Unknown)
#9  0x007f520ab74b7b in (Unknown)
#10 0x007f520ab752ab in (Unknown)
#11 0x007f520a86b93a in (Unknown)
#12 0x007f520aad087b in (Unknown)
#13 0x007f520aad08ba in (Unknown)
#14 0x007f520ad95045 in PlayerMain(int, char**)
#15 0x007f520953d488 in (Unknown)
#16 0x007f520953d54c in __libc_start_main
#17 0x00000000201029 in (Unknown)
Comment 4 Jean-Luc 2025-03-12 00:22:07 UTC
I've investigated further and now found it's a bug in Unity's Vulkan RHI; this bug can be closed.
Comment 5 Bug Janitor Service 2025-03-27 03:46:45 UTC
🐛🧹 ⚠️ This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information, then set the bug status to REPORTED. If there is no change for at least 30 days, it will be automatically closed as RESOLVED WORKSFORME.

For more information about our bug triaging procedures, please read https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging.

Thank you for helping us make KDE software even better for everyone!
Comment 6 Bug Janitor Service 2025-04-11 03:47:05 UTC
🐛🧹 This bug has been in NEEDSINFO status with no change for at least 30 days. Closing as RESOLVED WORKSFORME.