Bug 409852 - Okular takes an extreme amount of time to load a djvu file over samba
Summary: Okular takes an extreme amount of time to load a djvu file over samba
Status: RESOLVED WORKSFORME
Alias: None
Product: okular
Classification: Applications
Component: DjVu backend (show other bugs)
Version: 1.3.3
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
: 418691 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-07-16 08:53 UTC by John van Spaandonk
Modified: 2022-12-15 17:23 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John van Spaandonk 2019-07-16 08:53:24 UTC
SUMMARY
Loading a book (djvu) from my NAS in okular can take up to 30 seconds.
The problems seems less big with PDF books.
Book size 2 to 3 megabytes, so not particularly big.
Copying the same book from the NAS by dragging it from Dolphin to a local folder (SSD) takes about .2 seconds. Opening in Okular from there takes about .2  seconds (difficult to time, but very fast). So the underlying infrastructure seems to work fine, therefore I think the problem is related to Okular.

I conclude that when I open a document in Okular over samba I pay a performance penalty of a factor of 50 - 100. This makes it unusable to browse books there.

My setup I used to reproduce this problem.
Kubuntu18.04, desktop computer connected to NAS via 1Gbit ethernet cable.
Note that this is a fast network setup, so now slow links / wireless etc.
The NAS drive is listed in the fstab with this line, and thus mounted a system startup:
/192.168.1.2/NAME        /media/MOUNT_POINT  cifs   user=XXXX,password=XXXX,rw,user,nosuid,uid=1000,gid=100,_netdev,vers=1.0    0       0

STEPS TO REPRODUCE
1. Browse to the document folder on the NAS
2. Double click a document to open it in Okular
3. 

OBSERVED RESULT
The whole Okular interface blocks for 30-40 seconds (also does not redraw so it messes up the desktop view). The rest of the desktop is usable as normal.

EXPECTED RESULT
View the book in Okular in less than .5 seconds

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Kubuntu 18.04 LTS
(available in About System)
KDE Plasma Version: 5.12.7
KDE Frameworks Version: 5.44.0
Qt Version: 5.9.5

ADDITIONAL INFORMATION
I used journalctl to look in the syslog, but all it says is  ResourceScoreUpdated: "4625dd2c-8a74-4017-8be6-6dc7c47d29ab" "okularapplication_djvu" .....
Comment 1 John van Spaandonk 2019-07-16 08:59:58 UTC
Additional information: other Okular document windows stay usable as well.
So only the newly created Okular window is frozen, and displays part of what was under it, since it does not update.
Comment 2 Nate Graham 2019-07-16 14:41:31 UTC
Does the issue reproduce if you try to:
1. Open the file from Okular's Open dialog?

2. Browse to the file using a KIOslave path (e.g. smb://server/share/path/to/file.djvu) rather than via a local mount and then try to open it?

3. Open the same file in a different KDE app (e.g. Kate; it won't be usable, but it will try to load)?

4. Use Okular to open a different kind of document file that's located on that Samba share?
Comment 3 John van Spaandonk 2019-07-16 17:16:18 UTC
Nate thanks for looking into this.
Answering your information request:
1.  I tried recent files from the Okular file menu, also takes very long / same as double clicking in Dolphin
2. smb://192.168.1.2/data/ (this is the literal string I typed in Dolphin) reports a timeout on server in Dolphin. TheKIO smb slave does not seem to work for me. The address is correct.
3. The file opens in kate in about .5 second, the same file in Okular in about 30 seconds.
4. Using Okular to open a PDF document is not as fast as local, but still about 10 times faster than a .djv or .djvu file.
 
For me the analysis points to the .djv part of Okular.
Comment 4 Nate Graham 2019-07-16 17:20:30 UTC
Thanks, that's very good information.

It would be great if you can somehow get the Samba KIOSlave working to try loading it directly from that path rather than the local mount. You can try adding the username and password into the URL, like so: smb://user:password@192.168.1.2/data/
Comment 5 John van Spaandonk 2019-07-16 20:18:20 UTC
Good idea nate!

On the workstation: 
Same problem with the smb client, server timeout.
Tried with my kde laptop, which was kubuntu 18.04 also but I managed to rebase it to muon, it is current. 
So plasma 5.16.2 I think.

Here the kio-slave works: book read in about 2 seconds, over wifi even.
using (in another Dolphin tab) a mounted smb share (via fstab) I had to kill okular after 1:30 had passed. Laptop is 8 years old dell XPS, not as fast as the desktop. Note that Okular blocks also that Dolphin instance until I kill it.

But at least I managed to show that using smb: on the laptop it is much faster than via a mounted drive on the desktop. Same book takes about 40 seconds on the desktop.
Comment 6 Albert Astals Cid 2020-03-10 21:28:13 UTC
*** Bug 418691 has been marked as a duplicate of this bug. ***
Comment 7 John van Spaandonk 2022-12-15 17:23:50 UTC
This seems to have been solved, perhaps by updating a backend. I will close my bug report. 
I also tested the duplicate bug 418691 by downloading the attached picture to a samba share and opening it with okular. This also works for me.