Bug 412155

Summary: Gwenview freezes when opening single file in directory with many files
Product: [Applications] gwenview Reporter: MartinG <gronslet>
Component: generalAssignee: Gwenview Bugs <gwenview-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: normal CC: nate, postix
Priority: NOR    
Version: 18.12.2   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

Description MartinG 2019-09-21 12:58:18 UTC
SUMMARY
When I open a single file in a directory with many files, Gwenview freezes in several seconds. The reason seems to be that Gwenview insists on reading (meta?) info of every file in the directory.

This is very annoying when opening a single image on a remote share (eg. mounted via sshfs or cifs), since startup may be delayed for more than a minute.

STEPS TO REPRODUCE
1. Open an image with Gwenview in a directory with many files (thousands)
2. Image shows fully or partly, and Gwenview is frozen. Eg cannot go to next image in folder
3. Wait for a certain time, and Gwenview functions normally again.

OBSERVED RESULT
I did a strace in a folder pointing to a remotely connected filesystem containing ca 12000 jpeg files:

$ strace gwenview file_2019_09_20_12_00_03.jpg

Gwenview then spits out thousands of lines:

stat("/home/user/mnt/host/share/file_2019_01_15_06_00_00.jpg", {st_mode=S_IFREG|0755, st_size=231511, ...}) = 0
openat(AT_FDCWD, "/home/user/mnt/host/share/file_2019_01_15_06_00_00.jpg", O_RDONLY|O_CLOEXEC) = 26
statx(26, "", AT_STATX_SYNC_AS_STAT|AT_EMPTY_PATH, STATX_ALL, {stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFREG|0755, stx_size=231511, ...}) = 0
close(26)                               = 0
statx(AT_FDCWD, "/home/user/mnt/host/share/file_2019_01_15_06_30_01.jpg", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFREG|0755, stx_size=231348, ...}) = 0


EXPECTED RESULT
Gwenview should show the single image, maybe start caching "next" and "previous" image in a background thread, not freeze.

SOFTWARE/OS VERSIONS
Operating System: Fedora 30
KDE Plasma Version: 5.15.5
KDE Frameworks Version: 5.59.0
Qt Version: 5.12.4
Kernel Version: 5.2.13-200.fc30.x86_64
OS Type: 64-bit
Processors: 12 × Intel® Core™ i9-8950HK CPU @ 2.90GHz
Memory: 31.0 GiB of RAM
Comment 1 Nate Graham 2019-10-07 03:53:19 UTC

*** This bug has been marked as a duplicate of bug 331435 ***