strawberrymusicplayer / strawberry

:strawberry: Strawberry Music Player
https://www.strawberrymusicplayer.org/
GNU General Public License v3.0
2.74k stars 191 forks source link

When a playlist has songs imported from a CUE sheet, after the application has been running for a few days, all interactions slow greatly #853

Closed nike4613 closed 2 years ago

nike4613 commented 2 years ago

Describe the bug When a playlist has songs imported from a CUE sheet, after the application has been running for a few days, all interactions slow to a nearly unusable speed, sometimes taking 10 seconds to simply resume playback. I have noticed that the freeze gets longer the longer Strawberry has been open.

I have observed this freeze happening when:

During this freeze, Strawberry eats up a full core of CPU, presumably sitting in a fairly tight loop somewhere.

To Reproduce

  1. Open Strawberry
  2. Add songs in your collection from a CUE sheet to your playlist.
  3. Select Shuffle Albums/Repeat Playlist
  4. Leave it on, playing for a several days
  5. Attempt to interact with Strawberry

Expected behavior No freezes when interacting in any scenario.

System Information:

Additional context In my handful of attempts to debug this myself, I have opened up the stack viewer in Process Hacker for the thread which is eating CPU, and tried to figure out what might be causing this. The most recent time I did this, just before posting this issue, I got the following:

0, Qt6Core.dll!ZNK18QAbstractItemModel9multiDataERK11QModelIndex18QModelRoleDataSpan+0x1a7
1, Qt6Core.dll!ZN21QPersistentModelIndexC2ERK11QModelIndex+0xd4
2, Qt6Widgets.dll!ZN9QUndoView11qt_metacallEN11QMetaObject4CallEiPPv+0xb1ff7
3, Qt6Widgets.dll!ZNK17QAccessibleWidget7isValidEv+0xd4ed
4, qwindows.dll!qt_plugin_instance+0x7317c
5, Qt6Widgets.dll!ZN14QWidgetPrivate22paintSiblingsRecursiveEP12QPaintDeviceRK5QListIP7QObjectEiRK7QRegionRK6QPoint6QFlagsINS_14DrawWidgetFlagEEP8QPainterP21QWidgetRepaintManager+0xa32
6, Qt6Widgets.dll!ZN12QApplication15setActiveWindowEP7QWidget+0x59b
7, Qt6Widgets.dll!ZN19QApplicationPrivate24notifyActiveWindowChangeEP7QWindow+0x3b
8, Qt6Gui.dll!ZN22QGuiApplicationPrivate21processActivatedEventEPN29QWindowSystemInterfacePrivate20ActivatedWindowEventE+0x475
9, Qt6Gui.dll!ZN22QWindowSystemInterface22sendWindowSystemEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE+0x2d4
10, Qt6Core.dll!ZN21QEventDispatcherWin3213processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE+0x8ab
11, Qt6Gui.dll!ZN26QWindowsGuiEventDispatcher13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE+0x15
12, Qt6Core.dll!ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE+0x163
13, Qt6Core.dll!ZN16QCoreApplication4execEv+0x76
14, strawberry.exe+0x2730
15, strawberry.exe+0x467cb2
16, strawberry.exe+0x13c1
17, strawberry.exe+0x14d6
18, kernel32.dll!BaseThreadInitThunk+0x14
19, ntdll.dll!RtlUserThreadStart+0x21

Based on my zero knowledge of Qt, and only on this callstack, my guess is that the UndoView is storing a lot of elements, and iterating over all of them, of which there are potentially thousands, and performing some computation on them. The only thing which that doens't explain is why I only started experiencing this issue after adding songs from CUE sheets. So what do I know.

I suppose I should clarify: Strawberry is still usable, just somewhat annoying to interact with. There are no problems just playing music.

jonaski commented 2 years ago

There isn't much extra going on in the playlist related to CUE, there is some reloading stuff when you open the playlist but that doesn't explain this. So I think it is most likely coincidental that it occurred after adding CUE songs. If the problem occurs again try opening a new playlist, star the old one and close it to see if the high CPU usage is gone. This might be a Qt/Windows bug, otherwise I think others had reported it too as Strawberry has a much larger Linux user base than Windows.