Bug 512434 - System freezes for a few seconds when interacting with x11 app using xwayland inside a docker container
Summary: System freezes for a few seconds when interacting with x11 app using xwayland...
Status: REPORTED
Alias: None
Product: kwin
Classification: Plasma
Component: core (other bugs)
Version First Reported In: 6.5.3
Platform: CachyOS Linux
: NOR major
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-11-21 11:59 UTC by stellarix74
Modified: 2025-12-19 16:41 UTC (History)
0 users

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


Attachments
kwin_wayland backtrace (15.42 KB, text/plain)
2025-11-25 08:07 UTC, stellarix74
Details
wireshark (382.18 KB, image/png)
2025-11-25 09:06 UTC, stellarix74
Details

Note You need to log in before you can comment on or make changes to this bug.
Description stellarix74 2025-11-21 11:59:01 UTC
SUMMARY
System freezes for a few seconds when interacting with Burpsuite’s menu bar inside a Docker container using XWayland.

STEPS TO REPRODUCE
1. Build the docker image with the following Dockerfile
```
FROM artixlinux/artixlinux:base-openrc

WORKDIR /workspace

RUN pacman -Syu --noconfirm
RUN pacman -S --noconfirm jdk21-openjdk wget libxrandr libxtst fontconfig ttf-firacode-nerd
RUN wget "https://portswigger.net/burp/releases/download?product=community&version=2025.9.5&type=Jar" -O BurpSuiteCommunity.jar

ENTRYPOINT ["/bin/bash"]
```

Build command:
`sudo docker buildx build -t xwayland-test -f Dockerfile .`

2. Create a container using that image
Allow X access for GUI:
`xhost +local:`

Run the container:
`sudo docker run -ti -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -e XDG_RUNTIME_DIR=/tmp -e WAYLAND_DISPLAY=$WAYLAND_DISPLAY -v $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY:/tmp/$WAYLAND_DISPLAY --name xwayland xwayland-test`

3. Start burpsuite in the container:
`_JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true' java -jar BurpSuiteCommunity.jar` 

OBSERVED RESULT
When hovering over or clicking the items in Burp’s main menu bar (Burp / Project / Intruder etc), or when a new window/dialog spawns, the entire system freezes for a few seconds.
Quitting the application also triggers the freeze.

EXPECTED RESULT
X11 applications running inside a Docker container via XWayland should not freeze the system.

SOFTWARE/OS VERSIONS

Operating System: CachyOS Linux
KDE Plasma Version: 6.5.3
KDE Frameworks Version: 6.20.0
Qt Version: 6.10.0
Kernel Version: 6.17.8-2-cachyos (64-bit)
Graphics Platform: Wayland

ADDITIONAL INFORMATION
`journalctl -f` logs during freeze events.
Nov 21 17:26:27 cachyos kwin_wayland[27697]: The main thread was hanging temporarily!
Nov 21 17:26:29 cachyos systemd[1420]: app-org.kde.dolphin@61fc296ce5794620ad50b2d4fe797ce2.service: Consumed 2.470s CPU time, 182.1M memory peak.
Nov 21 17:26:31 cachyos kwin_wayland[27697]: The main thread was hanging temporarily!
Nov 21 17:30:16 cachyos kwin_wayland[27697]: The main thread was hanging temporarily!
Nov 21 17:30:20 cachyos kwin_wayland[27697]: The main thread was hanging temporarily!
Nov 21 17:30:25 cachyos kwin_wayland[27697]: The main thread was hanging temporarily!
Nov 21 17:30:28 cachyos kwin_wayland[27697]: The main thread was hanging temporarily!
Nov 21 17:30:32 cachyos kwin_wayland[27697]: The main thread was hanging temporarily!
Nov 21 17:30:35 cachyos kwin_wayland[27697]: 0x1: GL_INVALID_VALUE in glTexSubImage2D(xoffset 0 + width 48 > 10)
Nov 21 17:30:39 cachyos kwin_wayland[27697]: The main thread was hanging temporarily!

Video showing the freezes:
https://youtu.be/9wH5EgBtB0M
Comment 1 stellarix74 2025-11-25 08:07:55 UTC
Created attachment 187150 [details]
kwin_wayland backtrace
Comment 2 stellarix74 2025-11-25 09:06:25 UTC
Created attachment 187151 [details]
wireshark

I did another test by running Thunar with x11 backend:
`GDK_BACKEND=x11 thunar`

I found that the host OS was trying to resolve the container’s hostname by sending DNS or LLMNR queries to the container (see attached image).

As soon as I added the container’s hostname to the host’s /etc/hosts file, all freezes completely disappeared:
```
# Standard host addresses
127.0.0.1  xwayland localhost
```

If the freeze was caused by the host being unable to resolve the container, KDE should not be freezing because of that.

So I’m not sure whether this issue is related to the KWin code here:
https://invent.kde.org/plasma/kwin/-/blob/master/src/backends/drm/drm_commit_thread.cpp, or something caused by Docker, or NetworkManager.
Comment 3 stellarix74 2025-12-19 16:41:35 UTC
I tested this again but using Arch Linux as the host machine.
I found that no freezes occur there, and systemd-resolved is disabled by default. Once I enable it, the freezes come back.

CachyOS has systemd-resolved enabled, so my current workaround to get rid of these freezes is either to:
- Add the Docker container hostname to the host machine’s /etc/hosts
- Disable/stop systemd-resolved with `sudo systemctl stop systemd-resolved`, then stop these two sockets `systemd-resolved-monitor.socket, systemd-resolved-varlink.socket`

I also noticed that the timing of the DNS query is roughly the same as the duration of the freezes.

# systemd-resolved disabled (instant output):
[arch ~]$ resolvectl query xwayland
xwayland: resolve call failed: Could not activate remote peer 'org.freedesktop.resolve1': activation request failed: unknown unit

# systemd-resolved enabled (~3-4s):
[arch ~]$ resolvectl query xwayland
xwayland: 'xwayland' not found

Similar problems:
https://discuss.linuxcontainers.org/t/running-xwayland-gui-application-on-top-of-host-desktop-environment-causes-kwin-wayland-drm-to-freeze-computer/24211/8

https://discuss.linuxcontainers.org/t/x11-freezes-for-a-few-seconds-in-lxd-container/10095/8

https://bugs.kde.org/show_bug.cgi?id=510290