Bug 486423 - Avoid unnecessary stat calls for recent files and directories
Summary: Avoid unnecessary stat calls for recent files and directories
Status: REPORTED
Alias: None
Product: gwenview
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Gwenview Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-02 01:06 UTC by Pedro V
Modified: 2024-05-02 01:06 UTC (History)
0 users

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 Pedro V 2024-05-02 01:06:46 UTC
Many KDE programs have an issue with doing a whole lot of I/O undesired by the user, and gwenview seems to be no exception. This is mostly a problem with network mounted drives not rarely having high latency, and occasionally not even responding, leading to programs trying to use them freezing for a while.

In my case I've had an NFS mount pointing to a remote HDD which was getting quite hammered, so it was not responding for 10+ seconds at a time. A more usual example of something like this happening is an NFS mount not responding at all due to networking issues which tends to completely freeze quite a few misbehaving programs.

Found it odd that gwenview is affected as I was trying to look at local pictures, but a quick strace run revealed what's going on:

1) Recently opened files are checked out with stat calls and even opened to do another stat with the file handle.

2) After entries from ~/.local/share/gwenview/recentfolders/ get loaded, the directories there get checked out with stat.

3) When closing the program, fstab gets read and mount points get checked out with stat.

The last one is likely done by an external library providing info for the "Places" tab (although that isn't shown in my test run), so let's consider it out of the scope of the bug report, just included for the sake of completeness.
Aside from that, there's the nuisance that recent file and directory info is not just loaded, but everything pointed to gets checked out even when there's no recent information is shown. I wasn't even aware of this feature as I was always opening pictures directly, and I've just recently discovered that there's the "Open Recent" menu item, and recent directories and files get shown when gwenview is started with no file specified.

I'm not exactly sure why is the directory and file stat checking done when gwenview is launched to show a specific file. Initially I thought that maybe it checks recent entries to see if files were deleted, but a quick test of deleting a picture which then keeps showing up in the "Open Recent" menu item revealed that not to be the case.
Given that, I believe the stat calls shouldn't happen when the "Recent Folders" and "Recent Files" tabs aren't shown which is the case when gwenview is used to view specific files.