Bug 501073 - kwin gets locked up playing a youtube video in firefox and "kwin_wayland_drm: The main thread was hanging temporarily!"
Summary: kwin gets locked up playing a youtube video in firefox and "kwin_wayland_drm:...
Status: REPORTED
Alias: None
Product: kwin
Classification: Plasma
Component: core (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-04 21:16 UTC by andy
Modified: 2025-03-14 11:31 UTC (History)
3 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 andy 2025-03-04 21:16:08 UTC
SUMMARY
Clicking a youtube link in firefox completely freezes up the graphics on all monitors but audio is playing. I can't see any visual changes. Clicking the back button on the mouse will do nothing initially, but after a long lag navigates away from the page and animation to the desktop is restored.

STEPS TO REPRODUCE
1. wayland desktop & running firefox native wayland
2. navigate to e.g. https://news.ycombinator.com/item?id=43255446
3. click the link to youtube
4. Click back button on mouse immediately

OBSERVED RESULT
- hear the audio from the video without any issues
- entire desktop frozen. Ctrl+Alt+Fkeys also doesn't affect the output
- after about a minute the back button press seems to go through, return to desktop with firefox navigated to the previous page and everything back to normal

It's repeatable for me.

Timeline:
- 12:58:51: The timestamp when the clock is initially frozen on my desktop
- 12:59:16: the image on the desktop changed once: I see the firefox page navigate backwards, but desktop & clock still frozen
- 12:59:41: finally animation and mouse etc restored

The journal:
Mar 04 12:58:51 rtkit-daemon[6414]: Supervising 7 threads of 4 processes of 2 users.
Mar 04 12:58:51 rtkit-daemon[6414]: Supervising 7 threads of 4 processes of 2 users.
Mar 04 12:58:51 rtkit-daemon[6414]: Successfully made thread 680723 of process 680474 owned by '1000' RT at priority 10.
Mar 04 12:58:51 rtkit-daemon[6414]: Supervising 8 threads of 5 processes of 2 users.
Mar 04 12:58:51 rtkit-daemon[6414]: Supervising 8 threads of 5 processes of 2 users.
Mar 04 12:58:51 rtkit-daemon[6414]: Supervising 8 threads of 5 processes of 2 users.
Mar 04 12:58:51 rtkit-daemon[6414]: Supervising 8 threads of 5 processes of 2 users.
Mar 04 12:58:51 rtkit-daemon[6414]: Supervising 8 threads of 5 processes of 2 users.
Mar 04 12:58:54 rtkit-daemon[6414]: Supervising 8 threads of 5 processes of 2 users.
Mar 04 12:58:54 rtkit-daemon[6414]: Supervising 8 threads of 5 processes of 2 users.
Mar 04 12:59:15 systemd[1]: systemd-timedated.service: Deactivated successfully.
Mar 04 12:59:16 kwin_wayland[6386]: kwin_wayland_drm: The main thread was hanging temporarily!
Mar 04 12:59:16 plasmashell[6583]: file:///usr/share/plasma/plasmoids/org.kde.plasma.private.systemtray/contents/ui/items/PlasmoidItem.qml:24: TypeError: Cannot read property 'toolTipMainText' of null
Mar 04 12:59:41 kwin_wayland[6386]: kwin_wayland_drm: The main thread was hanging temporarily!
Mar 04 12:59:41 kwin_wayland[6386]: kwin_wayland_drm: The main thread was hanging temporarily!
Mar 04 12:59:41 kwin_wayland[6386]: kwin_wayland_drm: atomic commit failed: Invalid argument
Mar 04 12:59:41 kwin_wayland[6386]: kwin_wayland_drm: atomic commit failed: Invalid argument
Mar 04 12:59:41 kwin_wayland[6386]: kwin_core: Cannot grant a token to KWin::ClientConnection(0x61b5fca9d700)
Mar 04 12:59:41 kwin_wayland[6386]: kwin_wayland_drm: atomic commit failed: Permission denied

Specific events at the relevant timestamps I recorded:
- 12:58:51: initial freezing correpsonds to rtkit-daemon messages
- 12:59:16: momentary un-freezing corresponds to "kwin_wayland_drm: The main thread was hanging temporarily!"
- 12:59:41: final unfreezing corresponds with more kwin_wayland_drm and kwin_core messages

Also after this a lot of ` bluetoothd[4766]: Endpoint unregistered` then ` bluetoothd[4766]: Endpoint registered:` and org.kde.pulseaudio messages.

 E.g:
Mar 04 12:59:42 bluetoothd[4766]: Endpoint registered: sender=:1.450 path=/MediaEndpoint/A2DPSource/opus_05
Mar 04 12:59:42 bluetoothd[4766]: Endpoint registered: sender=:1.450 path=/MediaEndpoint/A2DPSink/opus_05_duplex
Mar 04 12:59:42 bluetoothd[4766]: Endpoint registered: sender=:1.450 path=/MediaEndpoint/A2DPSource/opus_05_duplex
Mar 04 12:59:42 kded6[268459]: org.kde.pulseaudio: No object for name "auto_null"
Mar 04 12:59:42 kded6[268459]: org.kde.pulseaudio: No object for name "auto_null.monitor"
Mar 04 12:59:42 plasmashell[268485]: org.kde.pulseaudio: No object for name "auto_null"
Mar 04 12:59:42 plasmashell[268485]: org.kde.pulseaudio: No object for name "auto_null.monitor"
Mar 04 12:59:42 kded6[268459]: org.kde.pulseaudio: No object for name "@DEFAULT_SINK@"
Mar 04 12:59:42 kded6[268459]: org.kde.pulseaudio: No object for name "@DEFAULT_SOURCE@"
Mar 04 12:59:42 plasmashell[268485]: org.kde.pulseaudio: No object for name "@DEFAULT_SINK@"
Mar 04 12:59:42 plasmashell[268485]: org.kde.pulseaudio: No object for name "@DEFAULT_SOURCE@"
Mar 04 12:59:42 kded6[268459]: org.kde.pulseaudio: No object for name "@DEFAULT_SINK@"
Mar 04 12:59:42 kded6[268459]: org.kde.pulseaudio: No object for name "@DEFAULT_SOURCE@"
Mar 04 12:59:42 kded6[268459]: org.kde.pulseaudio: No object for name "alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor"
Mar 04 12:59:42 plasmashell[268485]: org.kde.pulseaudio: No object for name "@DEFAULT_SINK@"
Mar 04 12:59:42 plasmashell[268485]: org.kde.pulseaudio: No object for name "@DEFAULT_SOURCE@"
Mar 04 12:59:42 plasmashell[268485]: org.kde.pulseaudio: No object for name "alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor"
Mar 04 12:59:42 kded6[268459]: org.kde.pulseaudio: No object for name "alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor"
Mar 04 12:59:42 plasmashell[268485]: org.kde.pulseaudio: No object for name "alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor"
Mar 04 12:59:42 bluetoothd[4766]: Endpoint unregistered: sender=:1.450 path=/MediaEndpoint/A2DPSource/ldac
Mar 04 12:59:42 bluetoothd[4766]: Endpoint unregistered: sender=:1.450 path=/MediaEndpoint/A2DPSink/aptx_hd
Mar 04 12:59:42 bluetoothd[4766]: Endpoint unregistered: sender=:1.450 path=/MediaEndpoint/A2DPSource/aptx_hd


EXPECTED RESULT
- firefox shouldn't break the compositor

SOFTWARE/OS VERSIONS

Linux/KDE Plasma: Arch Linux, 6.12.17-1-lts (64-bit)
KDE Plasma Version: 6.3.2
KDE Frameworks Version: 6.11.0 
Qt Version: 6.8.2

Firefox 135.0.1

ADDITIONAL INFORMATION
This is new, I just updated my system. Previous version without this issue included KDE Plasma Version: 6.2.4, Qt: 6.8.1.

My session is running with `KWIN_DRM_DEVICES=/dev/dri/card1 exec startplasma-wayland` as I have two graphics cards. 

No issues with chromium
Comment 1 andy 2025-03-06 00:34:32 UTC
Encountered this again clicking a youtube link without thinking. I got the same hanging, but on a second attempt afterwards it did not hang.

The pattern is:
- When rtkit-daemon gives firefox higher priority thread as requested for youtube video playback, the system freezes up. When it unfreezes we see the kwin_wayland_drm message that the main thread was hanging. Kind of seems like the firefox thread becomes so high priority it completely blocks the compositor??
- the 2nd attempt shows the same RT priority messages, but for whatever reason it didn't freeze so no messages about kwin_wayland hanging

Log messages of first encounter:

Mar 05 16:11:54 rtkit-daemon[6414]: Supervising 10 threads of 6 processes of 2 users.
Mar 05 16:11:54 rtkit-daemon[6414]: Supervising 10 threads of 6 processes of 2 users.
Mar 05 16:12:22 rtkit-daemon[6414]: Supervising 10 threads of 6 processes of 2 users.
Mar 05 16:12:22 rtkit-daemon[6414]: Supervising 10 threads of 6 processes of 2 users.
Mar 05 16:12:22 rtkit-daemon[6414]: Successfully made thread 1523890 of process 1518008 owned by '1000' RT at priority 10.
Mar 05 16:12:22 rtkit-daemon[6414]: Supervising 11 threads of 7 processes of 2 users.
Mar 05 16:12:22 rtkit-daemon[6414]: Supervising 11 threads of 7 processes of 2 users.
Mar 05 16:12:22 rtkit-daemon[6414]: Supervising 11 threads of 7 processes of 2 users.
Mar 05 16:12:25 rtkit-daemon[6414]: Supervising 11 threads of 7 processes of 2 users.
Mar 05 16:12:25 rtkit-daemon[6414]: Supervising 11 threads of 7 processes of 2 users.
Mar 05 16:12:47 kwin_wayland[6386]: kwin_wayland_drm: The main thread was hanging temporarily!
Mar 05 16:12:47 kwin_wayland[6386]: kwin_core: Cannot grant a token to KWin::ClientConnection(0x61b5fce7ca10)
Mar 05 16:12:58 kwin_wayland[6386]: kwin_core: Cannot grant a token to KWin::ClientConnection(0x61b5fca9d700)

Then I tried clicking the back button, but after about a minute when animation came back I found a different window focused (must have clicked another window by accident). Going back to firefox the youtube video was playing normally.

So I tried navigating back, then forward again. Now the youtube video playing normally without the big minute freeze up. The journal shows:

Mar 05 16:21:01 rtkit-daemon[6414]: Supervising 10 threads of 6 processes of 2 users.
Mar 05 16:21:01 rtkit-daemon[6414]: Supervising 10 threads of 6 processes of 2 users.
Mar 05 16:21:01 rtkit-daemon[6414]: Successfully made thread 1528303 of process 1526394 owned by '1000' RT at priority 10.
Mar 05 16:21:01 rtkit-daemon[6414]: Supervising 11 threads of 7 processes of 2 users.
Mar 05 16:21:01 rtkit-daemon[6414]: Supervising 11 threads of 7 processes of 2 users.
Mar 05 16:21:01 rtkit-daemon[6414]: Supervising 11 threads of 7 processes of 2 users.
Mar 05 16:21:02 rtkit-daemon[6414]: Supervising 11 threads of 7 processes of 2 users.
Mar 05 16:21:02 rtkit-daemon[6414]: Supervising 11 threads of 7 processes of 2 users.
Mar 05 16:21:06 kwin_wayland[6386]: kwin_core: Cannot grant a token to KWin::ClientConnection(0x61b5fca9d700)

We still see the same RT thread priority messages, but just no "kwin_wayland_drm: The main thread was hanging temporarily!" because it didn't hang.
Comment 2 andy 2025-03-11 22:37:30 UTC
https://discuss.kde.org/t/6-2-3-monitor-screen-freeze-when-playing-video/25796

Similar looking issue but
 `kwin_wayland_drm: Pageflip timed out! This is a kernel bug` 

instead of my
 `kwin_wayland_drm: The main thread was hanging temporarily!`
Comment 3 AB 2025-03-12 18:01:29 UTC
I have the same issue:

SOFTWARE/OS VERSIONS

Operating System: EndeavourOS
KDE Plasma Version: 6.3.3
KDE Frameworks Version: 6.11.0
Qt Version: 6.8.2
Kernel Version: 6.13.5-zen1-1-zen (64-bit) / 6.12.18-1-lts (64-bit)
Graphics Platform: Wayland
Processors: 24 × AMD Ryzen 9 3900X 12-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: AMD Radeon RX 5700 XT

Happens both on Firefox and Chrome
Comment 4 AB 2025-03-12 18:09:44 UTC
Journal file /var/log/journal/907f7623cf4741839043c6438cd51947/system@00062feca649d238-1b4953d3c132f608.journal~ is truncated, ignoring file.
Mar 12 14:03:25 h500i plasmashell[1715500]: org.kde.plasma.notificationmanager: Trying to replace notification with id 1310 which doesn't exist, creating a new one. This is an application bug!
Mar 12 14:03:25 h500i plasmashell[1715500]: file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/delegates/DelegatePopup.qml:136:17: QML Body: Binding loop detected for property "width"
Mar 12 14:03:25 h500i plasmashell[1715500]: The cached device pixel ratio value was stale on window update.  Please file a QTBUG which explains how to reproduce.
Mar 12 14:03:25 h500i plasmashell[1715500]: file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/delegates/DelegatePopup.qml:136:17: QML Body: Binding loop detected for property "width"
Mar 12 14:03:41 h500i rtkit-daemon[2746]: Supervising 8 threads of 5 processes of 1 users.
Mar 12 14:03:41 h500i rtkit-daemon[2746]: Supervising 8 threads of 5 processes of 1 users.
Mar 12 14:03:42 h500i rtkit-daemon[2746]: Supervising 8 threads of 5 processes of 1 users.
Mar 12 14:03:42 h500i rtkit-daemon[2746]: Supervising 8 threads of 5 processes of 1 users.
Mar 12 14:03:42 h500i plasmashell[1715500]: org.kde.plasma.notificationmanager: Trying to replace notification with id 1311 which doesn't exist, creating a new one. This is an application bug!
Mar 12 14:03:42 h500i plasmashell[1715500]: file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/delegates/DelegatePopup.qml:136:17: QML Body: Binding loop detected for property "width"
Mar 12 14:03:42 h500i plasmashell[1715500]: The cached device pixel ratio value was stale on window update.  Please file a QTBUG which explains how to reproduce.
Mar 12 14:03:42 h500i plasmashell[1715500]: file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/delegates/DelegatePopup.qml:136:17: QML Body: Binding loop detected for property "width"
Mar 12 14:03:44 h500i firefox[1986321]: Failed to create /home for shader cache (Permission denied)---disabling.
Mar 12 14:03:44 h500i firefox[1986321]: Failed to create /home for shader cache (Permission denied)---disabling.
Mar 12 14:03:44 h500i rtkit-daemon[2746]: Supervising 8 threads of 5 processes of 1 users.
Mar 12 14:03:44 h500i rtkit-daemon[2746]: Supervising 8 threads of 5 processes of 1 users.
Mar 12 14:03:44 h500i rtkit-daemon[2746]: Successfully made thread 2132499 of process 2110358 owned by '1000' RT at priority 10.
Mar 12 14:03:44 h500i rtkit-daemon[2746]: Supervising 9 threads of 6 processes of 1 users.
Mar 12 14:03:44 h500i firefox[1986321]: Failed to create /home for shader cache (Permission denied)---disabling.
Mar 12 14:03:44 h500i firefox[1986321]: Failed to create /home for shader cache (Permission denied)---disabling.
Mar 12 14:03:44 h500i firefox[1986321]: Failed to create /home for shader cache (Permission denied)---disabling.
Mar 12 14:03:44 h500i firefox[1986321]: Failed to create /home for shader cache (Permission denied)---disabling.
Mar 12 14:03:44 h500i firefox[1986321]: Failed to create /home for shader cache (Permission denied)---disabling.
Mar 12 14:03:44 h500i firefox[1986321]: Failed to create /home for shader cache (Permission denied)---disabling.
Mar 12 14:04:00 h500i krunner[2093635]: qt.core.qobject.connect: QObject::connect: No such signal Solid::Backends::Fstab::FstabStorageAccess::checkRequested(QString)
Mar 12 14:04:00 h500i krunner[2093635]: qt.core.qobject.connect: QObject::connect: No such signal Solid::Backends::Fstab::FstabStorageAccess::checkDone(Solid::ErrorType, QVariant, QString)
Mar 12 14:04:00 h500i plasmashell[1715500]: qt.core.qobject.connect: QObject::connect: No such signal Solid::Backends::Fstab::FstabStorageAccess::checkRequested(QString)
Mar 12 14:04:00 h500i plasmashell[1715500]: qt.core.qobject.connect: QObject::connect: No such signal Solid::Backends::Fstab::FstabStorageAccess::checkDone(Solid::ErrorType, QVariant, QString)
Mar 12 14:04:00 h500i plasmashell[1715500]: qt.core.qobject.connect: QObject::connect: No such signal Solid::Backends::Fstab::FstabStorageAccess::checkRequested(QString)
Mar 12 14:04:00 h500i plasmashell[1715500]: qt.core.qobject.connect: QObject::connect: No such signal Solid::Backends::Fstab::FstabStorageAccess::checkDone(Solid::ErrorType, QVariant, QString)
Mar 12 14:04:00 h500i plasmashell[1715500]: qt.core.qobject.connect: QObject::connect: No such signal Solid::Backends::Fstab::FstabStorageAccess::checkRequested(QString)
Mar 12 14:04:00 h500i plasmashell[1715500]: qt.core.qobject.connect: QObject::connect: No such signal Solid::Backends::Fstab::FstabStorageAccess::checkDone(Solid::ErrorType, QVariant, QString)
Mar 12 14:04:00 h500i krunner[2093635]: qt.core.qobject.connect: QObject::connect: No such signal Solid::Backends::Fstab::FstabStorageAccess::checkRequested(QString)
Mar 12 14:04:00 h500i krunner[2093635]: qt.core.qobject.connect: QObject::connect: No such signal Solid::Backends::Fstab::FstabStorageAccess::checkDone(Solid::ErrorType, QVariant, QString)
Mar 12 14:04:00 h500i plasmashell[1715500]: qt.core.qobject.connect: QObject::connect: No such signal Solid::Backends::Fstab::FstabStorageAccess::checkRequested(QString)
Mar 12 14:04:00 h500i plasmashell[1715500]: qt.core.qobject.connect: QObject::connect: No such signal Solid::Backends::Fstab::FstabStorageAccess::checkDone(Solid::ErrorType, QVariant, QString)
Mar 12 14:04:00 h500i plasmashell[1715500]: qt.core.qobject.connect: QObject::connect: No such signal Solid::Backends::Fstab::FstabStorageAccess::checkRequested(QString)
Mar 12 14:04:00 h500i plasmashell[1715500]: qt.core.qobject.connect: QObject::connect: No such signal Solid::Backends::Fstab::FstabStorageAccess::checkDone(Solid::ErrorType, QVariant, QString)
Mar 12 14:04:00 h500i plasmashell[1715500]: qt.core.qobject.connect: QObject::connect: No such signal Solid::Backends::Fstab::FstabStorageAccess::checkRequested(QString)
Mar 12 14:04:00 h500i plasmashell[1715500]: qt.core.qobject.connect: QObject::connect: No such signal Solid::Backends::Fstab::FstabStorageAccess::checkDone(Solid::ErrorType, QVariant, QString)
Mar 12 14:04:09 h500i kwin_wayland[1715215]: kwin_wayland_drm: The main thread was hanging temporarily!
Mar 12 14:04:09 h500i kwin_wayland[1715215]: kwin_wayland_drm: The main thread was hanging temporarily!
Mar 12 14:04:34 h500i kwin_wayland[1715215]: kwin_wayland_drm: The main thread was hanging temporarily!
Mar 12 14:04:34 h500i kwin_wayland[1715215]: kwin_wayland_drm: The main thread was hanging temporarily!
Mar 12 14:04:34 h500i kwin_wayland[1715215]: kwin_wayland_drm: The main thread was hanging temporarily!
Mar 12 14:04:34 h500i kwin_wayland[1715215]: kwin_wayland_drm: The main thread was hanging temporarily!
Mar 12 14:04:59 h500i kwin_wayland[1715215]: kwin_wayland_drm: The main thread was hanging temporarily!
Mar 12 14:04:59 h500i kwin_wayland[1715215]: kwin_wayland_drm: The main thread was hanging temporarily!
Mar 12 14:04:59 h500i kwin_wayland[1715215]: kwin_wayland_drm: The main thread was hanging temporarily!
Mar 12 14:04:59 h500i kwin_wayland[1715215]: kwin_wayland_drm: The main thread was hanging temporarily!
Mar 12 14:05:24 h500i kwin_wayland[1715215]: kf.windowsystem: static bool KX11Extras::mapViewport() may only be used on X11
Comment 5 AB 2025-03-12 20:10:44 UTC
Switching to Kernel Version: 6.6.82-1-lts66 (64-bit) seems to have fixed my issue.
Comment 6 Nate Graham 2025-03-12 20:47:10 UTC
Great!
Comment 7 andy 2025-03-13 04:53:01 UTC
Wait, Nate how is this solved? I'm using 6.12.17-1-lts in my report which is newer than AB's suggestion
Comment 8 AB 2025-03-13 19:42:37 UTC
Apologies I spoke too fast. My issue manifests again after some time, just not immediately after reboot. Happens on 6.6.82 and 6.12.18 from my testing.
Comment 9 andy 2025-03-13 20:36:57 UTC
I can note this has occurred to me on some other websites with media as well. 

I mentioned one time after everything unfroze the video played normally. But that seems less common and if I was unable to click the back button I have to find a way to kill the tab with the whole desktop and user input lagging to 1 frame every ~60 seconds.

A lifesaver workaround is to disable autoplay in firefox. Testing this I can navigate to a youtube page fine, but if I click play get the whole everything freezes situation. Clicking play and immediately clicking the back button takes like a solid minute of being frozen until it registers the click and unfreezes.
Comment 10 deadite66 2025-03-14 11:14:04 UTC
Having the same issue with stable and mainline kernels, haven't seen it on lts.
Comment 11 deadite66 2025-03-14 11:31:02 UTC
Sapphire NITRO+ RX 7800 XT 16GB