Kwin_wayland crashed (OOM), because pycharm script with psyside startSystemMove

I tried experiment with python+qt and the graphical session becomes completely unresponsive, including VT switching with Ctrl+Alt+F-keys, after some time the kwin session get killed because of oom.

My script is propably dumb, but it shouldn’t crash kwin with eating up my memory.

Not sure if its valid for a bugreport.

Fedora Linux 44
KDE-Plasma-Version: 6.7.1
KDE-Frameworks-Version: 6.27.0
Qt-Version: 6.11.1
Kernel-Version: 7.0.13-200.fc44.x86_64 (64-bit)
Grafik-Plattform: Wayland
Intel UHD Graphics 630

Jun 29 14:01:03 XXX kernel: DefaultDispatch invoked oom-killer: gfp_mask=0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), order=0, oom_score_adj=200
Jun 29 14:01:03 XXX kernel: [   1962]  1000  1962    96605        3        1        2         0   167936      548           200 kwin_wayland_wr
Jun 29 14:01:03 XXX kernel: [   1974]  1000  1974 17505118  9182013  9181680        6       327 91381760  2060869           200 kwin_wayland
Jun 29 14:01:03 XXX kernel: [  11419]  1000 11419   144477     5261     4758        2       501   286720        0           200 python
Jun 29 14:01:03 XXX kernel: oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=user.slice,mems_allowed=0,global_oom,task_memcg=/user.slice/user-1000.slice/user@1000.service/session.slice/plasma-kwin_wayland.service,task=kwin_wayland,pid=1974,uid=1000
Jun 29 14:01:03 XXX kernel: Out of memory: Killed process 1974 (kwin_wayland) total-vm:70020472kB, anon-rss:36726848kB, file-rss:24kB, shmem-rss:1308kB, UID:1000 pgtables:89240kB oom_score_adj:200
Jun 29 14:01:05 XXX kernel: oom_reaper: reaped process 1974 (kwin_wayland), now anon-rss:0kB, file-rss:0kB, shmem-rss:4kB

The Script, (drag out the button, it crashed every time on my pc and 2/3 of the time in the vm)

Just run in a disposable environment!

import sys

from PySide6.QtCore import QPoint, Qt
from PySide6.QtGui import QMouseEvent
from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton


class TestButton(QPushButton):
    def __init__(self, target: QMainWindow):
        super().__init__("Press and drag outside the window")
        self.target = target
        self.press_pos = QPoint()
        self.triggered = False

    def mousePressEvent(self, event: QMouseEvent) -> None:
        if event.button() == Qt.MouseButton.LeftButton:
            self.press_pos = event.position().toPoint()
            self.triggered = False

        super().mousePressEvent(event)

    def mouseMoveEvent(self, event: QMouseEvent) -> None:
        if (
            self.triggered
            or not event.buttons() & Qt.MouseButton.LeftButton
        ):
            super().mouseMoveEvent(event)
            return

        if (
            event.position().toPoint() - self.press_pos
        ).manhattanLength() < 40:
            super().mouseMoveEvent(event)
            return

        global_pos = event.globalPosition().toPoint()

        if self.window().frameGeometry().contains(global_pos):
            super().mouseMoveEvent(event)
            return

        self.triggered = True

        self.setParent(self.target)
        self.target.setCentralWidget(self)
        self.target.show()
        self.show()

        handle = self.target.windowHandle()

        if handle is not None:
            print("startSystemMove:", handle.startSystemMove())


app = QApplication(sys.argv)

floating = QMainWindow()
floating.setWindowTitle("Floating")
floating.resize(300, 150)

main = QMainWindow()
main.setWindowTitle("KWin minimal reproducer")
main.resize(500, 300)

button = TestButton(floating)
main.setCentralWidget(button)
main.show()

sys.exit(app.exec())

can’t edit title or post, its a python script (nothing pycharm related)

And the output in the vm where the script doesn’t crash is:

xdg_toplevel: surface has not been configured yet
Wayland fatal protocol error

So this seems to be a race condition.