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

            Bug ID: 520323
           Summary: KWin busy-loops writing application/x-zerosize to
                    clipboard ~50 times/second at 30% CPU, wiping all
                    clipboard writes within milliseconds
    Classification: Plasma
           Product: kwin
      Version First 6.6.5
       Reported In:
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: major
          Priority: NOR
         Component: wayland-generic
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

On Fedora 44 with Plasma 6.6.5 (KWin Wayland), kwin_wayland_wr enters a
busy-loop from session start, continuously writing application/x-zerosize to
the Wayland CLIPBOARD selection approximately every 20ms (~50 times/sec). This
wipes any legitimate clipboard write within 6-15ms of it being made, breaking
copy/paste for all native Wayland and XWayland applications.

Primary selection is unaffected (middle-click paste works). Some Flatpak
applications can occasionally write to clipboard successfully because
portal-mediated writes race with the wipe loop, but the behavior is
inconsistent.

The bug is conclusively isolated to KDE Plasma: installing Cinnamon on the same
machine (same kernel, same /home, same Flatpak apps, same hardware, same user
account) resolves the issue completely.

STEPS TO REPRODUCE

1. Boot a Plasma 6.6.5 Wayland session on Fedora 44 (system upgraded from F43)
2. Open Konsole and run:
     wl-copy "test"
     wl-paste --list-types
     wl-paste
3. Run: top -bn1 | grep kwin

OBSERVED RESULT

- wl-paste --list-types returns "application/x-zerosize"
- wl-paste returns empty
- Ctrl+V does not paste in any native or XWayland application
- Middle-click paste (primary selection) works
- kwin_wayland_wr consumes 28-32% CPU at idle with no user activity
- wl-paste --watch shows clipboard "changing" every 15-25ms continuously, even
with no user activity and no clipboard manager running

Diagnostic timeline (wl-paste --watch during wl-copy "test"):

  06.513  text/plain;charset=utf-8  (correct write succeeds)
  06.533  application/x-zerosize    (wiped 20ms later)
  06.548  application/x-zerosize
  06.568  application/x-zerosize
  [continues every ~20ms indefinitely]

top output (idle, no user activity):
  PID 5387 kwin_wayland_wr 28.7% CPU

fuser /run/user/1000/wayland-0 shows only kwin_wayland_wr holds the socket.

EXPECTED RESULT

- wl-paste returns "test"
- wl-paste --list-types returns text/plain;charset=utf-8
- kwin_wayland_wr CPU usage near 0% at idle
- Ctrl+V pastes the copied content normally

SOFTWARE/OS VERSIONS

Operating System: Fedora Linux 44 (KDE Plasma spin)
Kernel: 7.0.8-200.fc44.x86_64
KDE Plasma Version: 6.6.5
KDE Frameworks Version: (run `kinfo` to fill in - was not captured)
Qt Version: (run `kinfo` to fill in - was not captured)
Session: Wayland
GPU: AMD
Portals installed: xdg-desktop-portal 1.21.2, xdg-desktop-portal-kde 6.6.5,
xdg-desktop-portal-gtk 1.15.3
Upgrade history: Fedora 43 -> Fedora 44

ADDITIONAL INFORMATION

ISOLATION TEST (strongest evidence)

Installed Cinnamon desktop environment alongside KDE Plasma on the same Fedora
44 system. Logged out of Plasma, logged into Cinnamon session.

Same machine. Same kernel. Same /home directory. Same Flatpak apps. Same
hardware. Same user account. Only variable changed: desktop environment.

Result in Cinnamon: clipboard works perfectly. Ctrl+C/Ctrl+V function normally
across all applications including Brave Flatpak, Firefox Flatpak, native apps,
and terminal. No CPU spin. No x-zerosize wiping.

This eliminates as causes: kernel, hardware, GPU driver, Flatpak sandbox
configuration, xdg-desktop-portal, user /home state, and Wayland compositor
protocols in general. The bug is in KWin's clipboard implementation.

TROUBLESHOOTING ATTEMPTED WITHIN PLASMA (none resolved the issue)

- Killed plasmashell entirely - KWin CPU loop continues alone
- Killed and uninstalled copyq
- Stopped all xdg-desktop-portal services (xdg-desktop-portal.service,
plasma-xdg-desktop-portal-kde.service, xdg-desktop-portal-gtk.service)
- Moved aside entire user Plasma config (~/.config/kwinrc, klipperrc,
kglobalshortcutsrc, plasma-org.kde.plasma.desktop-appletsrc, plasmashellrc,
kded6rc)
- Removed klipper state (~/.local/share/klipper, ~/.cache/klipper)
- Disabled clipboard widget in system tray via System Tray Settings
- rpm -V plasma-workspace returned clean (no file tampering)
- Booted older F43 kernels - bug persists (rules out kernel)
- dnf reinstall plasma-workspace plasma-desktop kwin kwin-wayland
kf6-kwindowsystem qt6-qtwayland
- Set xdg-desktop-portal preferred backend to KDE via
~/.config/xdg-desktop-portal/portals.conf
- Set KeepClipboardContents=true in klipperrc
- Multiple full system reboots
- Tested wl-copy --foreground to keep data source alive (clipboard still wiped
within milliseconds)

WORKAROUND

No functional workaround exists within Plasma. Middle-click paste (primary
selection) works but cannot substitute for clipboard in typical workflows.
Switching to a non-Plasma desktop environment resolves the issue completely.

================================================================
END
================================================================

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to