Bug 426617 - Dolphin 100% CPU core usage
Summary: Dolphin 100% CPU core usage
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: panels: folders (show other bugs)
Version: 20.08.1
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-16 16:26 UTC by Tonurics
Modified: 2021-01-16 19:58 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 20.12


Attachments
Folder panel with sub-folders that can't expand. (5.76 KB, image/png)
2020-09-19 08:18 UTC, Tonurics
Details
gdb (6.73 KB, text/plain)
2020-09-20 23:31 UTC, Tonurics
Details
QT_MESSAGE_PATTERN (3.29 KB, text/plain)
2020-09-22 19:28 UTC, Tonurics
Details
Screenshot from Spectacle of a folder where issue occurs. (317.00 KB, image/png)
2020-11-05 23:37 UTC, Tonurics
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tonurics 2020-09-16 16:26:44 UTC
Dolphin will use increasing amounts of resources when the Folders panel is open and there are sub-folders that can't be expanded.

[STEPS TO REPRODUCE]
1. Start Dolphin [Hidden Files Shown]
2. Toggle Folder panel
3. Open a directory that has sub-folders [in the second tree level] that can't be expand.
4. Wait.

[OBSERVED RESULT]
Dolphin appears to endlessly recheck the sub-folders, testing to see if they can be expanded. The expanding arrows targets can be seen flashing many times a second next to any folder icons that can't expand.

The resource usage appears to grow the longer Dolphin is left in that state, with the flashing becoming increasingly noticeable and system load growing.

Collapsing the open folder handle in the Folder panel causes the issue to stop.

[EXPECTED RESULT]
Dolphin shouldn't be doing this.


[SOFTWARE/OS VERSIONS]
Linux/KDE Plasma: 5.8.9-arch2-1 [64bit]
KDE Plasma Version: 5.19.5
KDE Frameworks Version: 5.74.0
Qt Version: 5.15.1

[ADDITIONAL INFORMATION]
I reported the issue on 2020-09-08 as a comment to https://bugs.kde.org/show_bug.cgi?id=411349 but as that ticket is dated to 2019, likely caused by an unrelated issue [with thumbnails], and no one has responded... I'm reporting it here as it's own issue.
Comment 1 Elvis Angelaccio 2020-09-18 17:19:25 UTC
(In reply to Tonurics from comment #0)
> Dolphin will use increasing amounts of resources when the Folders panel is
> open and there are sub-folders that can't be expanded.
> 
> [STEPS TO REPRODUCE]
> 1. Start Dolphin [Hidden Files Shown]
> 2. Toggle Folder panel
> 3. Open a directory that has sub-folders [in the second tree level] that
> can't be expand.

What do you mean with "can't be expand" ? An empty folder?
Comment 2 Tonurics 2020-09-19 08:18:45 UTC
Created attachment 131763 [details]
Folder panel with sub-folders that can't expand.

I've put red squares where I see arrows flashing.

I would guess they start flashing at a rate of about ~12 times a second [creating a faux transparency effect like in an old video game]. Either because system load is building, or the function checking for sub-folders is self-referencing: over time the arrows appear on screen for longer periods of time.

This coincides with Dolphin using 100%.
Comment 3 Tonurics 2020-09-19 08:19:46 UTC
A node in the Folders panel tree element without a child, in this case: caused when a folder doesn't have a sub-folder inside of it.

[If you are using Details view mode, you get the same sort of tree element, but the folders can be expanded as long as it's not empty and empty folder. Whereas the Folders panel tree will only expand if there is a sub-folder inside the folder.]

I've attached a screenshot to better illustrate the issue.
Comment 4 Tonurics 2020-09-19 08:30:55 UTC
More info:

I'm not seeing the flashing in every location. For example: I'm currently seeing the flashing in /tmp and /home, but not in /srv or /etc

And in /home the flashing is only appearing on some of the folders, not on all nodes.

It's also not obvious where and when it will occur: as I see it on a mounted drive [where nothing is being written and nothing special should be happening].
Comment 5 Elvis Angelaccio 2020-09-20 21:17:19 UTC
Hmm I'm not able to reproduce it. Can you please run:

"gdb dolphin"

from Konsole? Then as soon as you hit the issue, press CTRL+C in Konsole, then type 'bt' and then copy here the text that you get.
Comment 6 Tonurics 2020-09-20 23:31:41 UTC
Created attachment 131816 [details]
gdb

Here you go.

Steps to reproduce on GUI:
1) Navigate to /tmp by typing the path into the address bar.
2) Double Click on tmp location in Folder panel to collapse it. [No noticeable flashing.]
3) Double Click on tmp location in Folder panel to expanding it. [Arrows are now flashing.]

Also, I may have discovered something while creating the dump: Unless I navigate using the Folder panel, the flashing arrows aren't visible until the Folder panel tree is expanded to a second level.

For example:

1) Start Dolphin [no flashing]
2) Double click on ~/Downloads from Folder panel [flashing]
3) Type in ~/Documents/foo [flashing]

1) Start Dolphin [no flashing]
2) Type in ~/Downloads/foo [no flashing]
3) Type in ~/Documents/bar [flashing]

1) Start Dolphin [no flashing]
2) Type in ~/Downloads [no flashing]
3) Type in ~/Documents/bar [no flashing]
3) Type in ~/Downloads/foo [flashing]
Comment 7 Elvis Angelaccio 2020-09-21 22:47:22 UTC
One more thing, can you run from Konsole:

QT_MESSAGE_PATTERN="%{function} %{message}" dolphin

and copy here the output when it starts the issue?
Comment 8 Tonurics 2020-09-22 19:28:33 UTC
Created attachment 131876 [details]
QT_MESSAGE_PATTERN

Here you go.
Comment 9 Justin Zobel 2020-10-27 00:32:29 UTC
(In reply to Elvis Angelaccio from comment #7)
> One more thing, can you run from Konsole:
> 
> QT_MESSAGE_PATTERN="%{function} %{message}" dolphin
> 
> and copy here the output when it starts the issue?

Evlis does the attachment in #8 provide enough insight to the issue?
Comment 10 Tonurics 2020-10-30 09:53:27 UTC
FYI: The issue is still present in 20.08.2

Let me know, if there's anything else I can do to assist.
Comment 11 Méven Car 2020-10-31 10:31:45 UTC
Reproduced locally.
Comment 12 Bug Janitor Service 2020-10-31 11:41:49 UTC
A possibly relevant merge request was started @ https://invent.kde.org/system/dolphin/-/merge_requests/90
Comment 13 Nate Graham 2020-11-03 02:22:18 UTC
Git commit ffe01ee8407559f46171bfea4aa6f21e37f945fb by Nate Graham, on behalf of Méven Car.
Committed on 03/11/2020 at 02:21.
Pushed by ngraham into branch 'master'.

FolderPanel: prevents scanning directory tree recursively

KFileItemListView contents are periodically scanned by KFileItemModelRolesUpdater.
It uses then KDirectoryContentsCounter to scan directories to determine their size possibly recursively.

Introduce a scanDirectories setting to disable directory scanning by KFileItemModelRolesUpdater.
FIXED-IN: 20.08.3

M  +16   -1    src/kitemviews/kfileitemlistview.cpp
M  +8    -0    src/kitemviews/kfileitemlistview.h
M  +19   -4    src/kitemviews/kfileitemmodelrolesupdater.cpp
M  +8    -0    src/kitemviews/kfileitemmodelrolesupdater.h
M  +1    -0    src/panels/folders/folderspanel.cpp

https://invent.kde.org/system/dolphin/commit/ffe01ee8407559f46171bfea4aa6f21e37f945fb
Comment 14 Tonurics 2020-11-05 23:34:20 UTC
I'm afraid to say I'm still seeing the issue in 20.08.3 [reproducible following the steps in comment 6].

Subjectively, I think 20.08.3 is a bit better. I've left Dolphin idle at a location that flashes for about 10 minutes and I don't think the CPU usage is growing over time anymore. As it would eventually get to 100% CPU.

I'll attach a screenshot of the folder I tested with. I was surprised: Spectacle actually caught the first sub-folder in the middle of a flash [note half an arrow icon].

By leaving Dolphin idle can report some consistent CPU numbers from top: 

*) Normal usage [with the flashing showing], Dolphin CPU usage stays at: 11.9%-12.6%.

*) Scrolling the Folder panel up [so "foobar2000" and the flashing items are not visible], Dolphin CPU drops to: 4%-4.3%

*) Collapsing the folder tree [so the sub-folders of "foobar2000" are not items in the Folder panel tree anymore], Dolphin CPU drops to: 0%
Comment 15 Tonurics 2020-11-05 23:37:58 UTC
Created attachment 133073 [details]
Screenshot from Spectacle of a folder where issue occurs.

Screenshot from Spectacle of a folder where issue occurs [and earlier CPU numbers were reported from]. Note "components" sub-folder was captured in the middle of flashing.
Comment 16 Tonurics 2020-11-05 23:41:58 UTC
I'll note that the icons and global themes were Breeze defaults at the time I reported this issue. [I just changed them last week, so would not think anything there is related to the issue.]
Comment 17 Méven Car 2020-11-06 06:00:06 UTC
(In reply to Tonurics from comment #14)
> I'm afraid to say I'm still seeing the issue in 20.08.3
> 
Unfortunately this bug fix did not make it in Dolphin 20.08.3 (https://invent.kde.org/system/dolphin/-/merge_requests/90#note_129658).
The commit message is not correct, but the fixed version in of the bug report is. 

Please report again once you will have have Dolphin 20.12 which is due next month.

> I'll attach a screenshot of the folder I tested with. I was surprised:
> Spectacle actually caught the first sub-folder in the middle of a flash
> [note half an arrow icon].
> 

X.org at it worst... The kind of issue Wayland was conceived not to have.