Bug 491946

Summary: Media player widget locks up plasmashell when playing specific song
Product: [Plasma] plasmashell Reporter: Paul <mail>
Component: Media PlayerAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: kde, kdedev, krazykath, nate, niccolo, qydwhotmail, sitter
Priority: NOR    
Version: 6.1.4   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 6.2.0
Sentry Crash Report:
Attachments: d-spy of problematic track metadata
gdb and journalctl logs while causing hang and then aborting the process
my taskbar layout

Description Paul 2024-08-20 17:18:05 UTC
Created attachment 172779 [details]
d-spy of problematic track metadata

SUMMARY
If you have the media player widget that ships with KDE on your taskbar and you play this track through youtube music premium: https://music.youtube.com/watch?v=Q0d3zNikhvA&si=8y3Wig-6FF1pw9PI [Street Warriors (feat.Favorit89) by Jeremiah Kane] it will cause the plasmashell process to use 100% of a cpu core and make the taskbar unresponsive. 

SOFTWARE/OS VERSIONS
Linux:  EndeavorOS
KDE Plasma Version: 6.1.4
KDE Frameworks Version: 6.5.0
Qt Version: 6.7.2

ADDITIONAL INFORMATION
Other songs in the same album do not cause this (so likely not the album art?).

Using the 3rd party "minimum media controller" works fine while playing this track.

If you want, I can look up the results of d-bus calls to mpris just let me know what properties you want me to inspect etc.

Looking at the metadata property from org.mpris.MediaPlayer2.firefox.instance_* while the problematic track is playing gives me this:
```
(<{'mpris:trackid': <objectpath '/org/mpris/MediaPlayer2/firefox'>, 'xesam:title': <'Street Warriors'>, 'xesam:album': <'All or Nothing'>, 'xesam:artist': <['Jeremiah Kane']>, 'mpris:artUrl': <'file:///home/paul/.mozilla/firefox/firefox-mpris/2687_1.png'>}>,)
```

Here's a different song from the same album that doesn't cause the problem:
```
(<{'mpris:trackid': <objectpath '/org/mpris/MediaPlayer2/firefox'>, 'xesam:title': <'Vampirevania'>, 'xesam:album': <'All or Nothing'>, 'xesam:artist': <['Jeremiah Kane']>, 'mpris:artUrl': <'file:///home/paul/.mozilla/firefox/firefox-mpris/2687_1.png'>}>,)
```

Since I don't see anything problematic that's different between the two, I'd probably assume the issue is somewhere else.
Comment 1 Nate Graham 2024-08-21 03:32:22 UTC
I don't have YouTube Music premium, but I can play that song at that URL. On current git master, it doesn't do anything particularly strange to plasmashell for me.
Comment 2 Niccolò Venerandi 2024-08-21 09:15:42 UTC
I do have Youtube Premium, but I also can't reproduce the issue on master, the media player widget works fine.
Comment 3 Harald Sitter 2024-08-21 11:45:55 UTC
Please run 

kill -SIGABRT `pidof plasmashell`

to trigger a crash and obtain a trace. It should help shed some light on what it is stuck on
Comment 4 Nate Graham 2024-08-21 12:56:36 UTC
.
Comment 5 Paul 2024-08-21 16:02:51 UTC
Output of `journalctl -f /usr/bin/plasmashell` starting from the point where I cause plasmashell to hang by using the song.

```
Aug 21 10:46:21 paul-endeavoros-desktop plasmashell[2222]: qt.core.qobject.connect: QObject::connect: No such signal Solid::Backends::Fstab::FstabStorageAccess::repairRequested(QString)
Aug 21 10:46:21 paul-endeavoros-desktop plasmashell[2222]: qt.core.qobject.connect: QObject::connect: No such signal Solid::Backends::Fstab::FstabStorageAccess::repairDone(Solid::ErrorType, QVariant, QString)
Aug 21 10:46:21 paul-endeavoros-desktop plasmashell[2222]: qt.core.qobject.connect: QObject::connect: No such signal Solid::Backends::Fstab::FstabStorageAccess::repairRequested(QString)
Aug 21 10:46:21 paul-endeavoros-desktop plasmashell[2222]: qt.core.qobject.connect: QObject::connect: No such signal Solid::Backends::Fstab::FstabStorageAccess::repairDone(Solid::ErrorType, QVariant, QString)
Aug 21 10:46:21 paul-endeavoros-desktop plasmashell[2222]: Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
```
I then called `kill -SIGABRT 2222` (pid of plasmashell process that was hanging) and it output this:
```
Aug 21 10:48:37 paul-endeavoros-desktop plasmashell[4016]: KPackageStructure of KPluginMetaData(pluginId:"ink.chyk.minimumMediaController", fileName: "/home/paul/.local/share/plasma/plasmoids/ink.chyk.minimumMediaController/metadata.json") does not match requested format "Plasma/Applet"
Aug 21 10:48:37 paul-endeavoros-desktop plasmashell[4016]: kf.plasma.quick: Applet preload policy set to 1
Aug 21 10:48:37 paul-endeavoros-desktop plasmashell[4016]: file:///usr/share/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/main.qml:195:25: QML FolderViewDropArea (parent or ancestor of QQuickLayoutAttached): Binding loop detected for property "minimumWidth"
Aug 21 10:48:37 paul-endeavoros-desktop plasmashell[4016]: Toolbox not loading, toolbox package is either invalid or disabled.
Aug 21 10:48:37 paul-endeavoros-desktop plasmashell[4016]: file:///usr/share/plasma/plasmoids/org.kde.plasma.mediacontroller/contents/ui/CompactRepresentation.qml:64: TypeError: Cannot read property 'columnSpacing' of null
Aug 21 10:48:37 paul-endeavoros-desktop plasmashell[4016]: file:///usr/share/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/main.qml:195:25: QML FolderViewDropArea (parent or ancestor of QQuickLayoutAttached): Binding loop detected for property "minimumWidth"
Aug 21 10:48:37 paul-endeavoros-desktop plasmashell[4016]: Toolbox not loading, toolbox package is either invalid or disabled.
Aug 21 10:48:37 paul-endeavoros-desktop plasmashell[4016]: file:///usr/share/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/main.qml:195:25: QML FolderViewDropArea (parent or ancestor of QQuickLayoutAttached): Binding loop detected for property "minimumWidth"
Aug 21 10:48:37 paul-endeavoros-desktop plasmashell[4016]: Toolbox not loading, toolbox package is either invalid or disabled.
Aug 21 10:48:37 paul-endeavoros-desktop plasmashell[4016]: org.kde.plasma.containmentlayoutmanager: Trying to take space not available BasicAppletContainer_QMLTYPE_39_QML_68(0x5e5d1ea1e740, id="appletContainer", parent=0x744ae0358b90, geometry=4945.4,142 54x54)
Aug 21 10:48:37 paul-endeavoros-desktop plasmashell[4016]: org.kde.plasma.kicker: Entry is not valid "org.kde.kontact.desktop" 0x5e5d254b7490
Aug 21 10:48:37 paul-endeavoros-desktop plasmashell[4016]: org.kde.plasma.kicker: Entry is not valid "org.kde.discover.desktop" 0x5e5d254a2bf0
Aug 21 10:48:37 paul-endeavoros-desktop plasmashell[4016]: org.kde.plasma.kicker: Entry is not valid "org.kde.kontact.desktop" 0x5e5d254a3320
Aug 21 10:48:37 paul-endeavoros-desktop plasmashell[4016]: org.kde.plasma.kicker: Entry is not valid "org.kde.discover.desktop" 0x5e5d254a2d30
Aug 21 10:48:37 paul-endeavoros-desktop plasmashell[4016]: file:///usr/share/plasma/plasmoids/org.kde.plasma.private.systemtray/contents/ui/main.qml:162:21: QML KSortFilterProxyModel: Binding loop detected for property "sourceModel"
Aug 21 10:48:37 paul-endeavoros-desktop plasmashell[4016]: file:///usr/share/plasma/plasmoids/org.kde.plasma.private.systemtray/contents/ui/main.qml:162:21: QML KSortFilterProxyModel: Binding loop detected for property "sourceModel"
Aug 21 10:48:37 paul-endeavoros-desktop plasmashell[4016]: qt.core.qobject.connect: QObject::connect: No such signal Solid::Backends::Fstab::FstabStorageAccess::repairRequested(QString)
Aug 21 10:48:37 paul-endeavoros-desktop plasmashell[4016]: qt.core.qobject.connect: QObject::connect: No such signal Solid::Backends::Fstab::FstabStorageAccess::repairDone(Solid::ErrorType, QVariant, QString)
Aug 21 10:48:37 paul-endeavoros-desktop plasmashell[4016]: qt.core.qobject.connect: QObject::connect: No such signal Solid::Backends::Fstab::FstabStorageAccess::repairRequested(QString)
Aug 21 10:48:37 paul-endeavoros-desktop plasmashell[4016]: qt.core.qobject.connect: QObject::connect: No such signal Solid::Backends::Fstab::FstabStorageAccess::repairDone(Solid::ErrorType, QVariant, QString)
Aug 21 10:48:37 paul-endeavoros-desktop plasmashell[4016]: qt.dbus.integration: Could not connect "org.cups.cupsd.Notifier" to PrinterFinishingsChanged(QString, QString, QString, uint, QString, bool) :
Aug 21 10:48:37 paul-endeavoros-desktop plasmashell[4016]: kameleon supported false
Aug 21 10:48:37 paul-endeavoros-desktop plasmashell[4016]: kameleon enabled true
Aug 21 10:48:37 paul-endeavoros-desktop plasmashell[4016]: qml: SystemTray ItemLoader: Invalid state, cannot determine source!
Aug 21 10:48:37 paul-endeavoros-desktop plasmashell[4016]: error getting max keyboard brightness via dbus QDBusError("org.freedesktop.DBus.Error.UnknownObject", "No such object path '/org/kde/Solid/PowerManagement/Actions/KeyboardBrightnessControl'")
```

I'm a Rust dev so not familar with c++/kde dev so I'm working on trying to figure out how to get a proper stack trace (looking at this now https://community.kde.org/Plasma/Debugging), thought this might be useful to someone though so posting it.
Comment 6 Paul 2024-08-21 16:05:38 UTC
Is there an easy way for me to test against master? If that works for me then I guess we could assume it's fixed and just wait for a new release. Or if someone else could confirm it didn't work for them on the currently released versions but does on master.
Comment 7 Paul 2024-08-21 16:33:08 UTC
When running through plasmawindowed with gdb attached I've been unable to replicate the issue. I noticed when using plasmawindowed the next/previous buttons are grayed out and they aren't grayed out when running as a taskbar widget.

Looking into if I can attach gdb to the running plasmashell of the taskbar to get a trace that way.
Comment 8 Paul 2024-08-21 16:47:12 UTC
Created attachment 172823 [details]
gdb and journalctl logs while causing hang and then aborting the process

Okay was able to get a trace by attaching gdb to the running plasmashell process. I followed the guide under "Attach gdb to the plasmashell process" here: https://community.kde.org/Plasma/Debugging

Lmk if there's anything else that would help.
Comment 9 Harald Sitter 2024-08-21 22:27:26 UTC
Rather odd bug.

- standard panel
- put mediacontroller right of taskmanager and left of systray
- play https://music.youtube.com/watch?v=Q0d3zNikhvA&si=8y3Wig-6FF1pw9PI in firefox
- restart plasma
- 9/10 it will hang

What happens is that there appears to be a layout loop somewhere that keeps triggering the compactRepresentation's Layout.preferredWidth bindings to change. Seems somehow related to the Binding on layoutForm.
Comment 10 Paul 2024-08-21 22:57:58 UTC
Created attachment 172835 [details]
my taskbar layout

Oh interesting, I didn't think about it being caused by the position of the widget on the taskbar. I have it on the far left and have the taskbar on the top. I use spacers to center the "Icons only task manager". Attached a screenshot of my layout. With this layout, for me it happens every time I play that song.
Comment 11 Bug Janitor Service 2024-08-22 17:33:31 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4632
Comment 12 Fushan Wen 2024-08-22 18:45:50 UTC
Git commit c555ead7fd8241ec979b432eb48121097357208d by Fushan Wen.
Committed on 22/08/2024 at 18:44.
Pushed by fusionfuture into branch 'master'.

applets/mediacontroller: fix text layout in compact representation

When a Label with Layout.fillWidth: true and horizontalAlignment:
Text.AlignJustify inside a Layout, the text doesn't look good when the
available width is larger than the total width of all characters.
FIXED-IN: 6.2

M  +2    -1    applets/mediacontroller/package/contents/ui/CompactRepresentation.qml

https://invent.kde.org/plasma/plasma-workspace/-/commit/c555ead7fd8241ec979b432eb48121097357208d
Comment 13 Fushan Wen 2024-08-22 19:07:16 UTC
Git commit 77509b85ccc7b6c8ae722f85b679590d130c00d1 by Fushan Wen.
Committed on 22/08/2024 at 19:06.
Pushed by fusionfuture into branch 'master'.

applets/mediacontroller: fix text layout in compact representation

When a Label with Layout.fillWidth: true and horizontalAlignment:
Text.AlignJustify inside a Layout, the text doesn't look good when the
available width is larger than the total width of all characters. This
adds a preferred width hint to work around the visual glitch.
FIXED-IN: 6.2

M  +1    -0    applets/mediacontroller/package/contents/ui/CompactRepresentation.qml

https://invent.kde.org/plasma/plasma-workspace/-/commit/77509b85ccc7b6c8ae722f85b679590d130c00d1
Comment 14 Nate Graham 2024-08-24 16:44:24 UTC
*** Bug 492109 has been marked as a duplicate of this bug. ***