Bug 396087 - Okular stops rendering some pages, locks up at 25% CPU usage and won't die
Summary: Okular stops rendering some pages, locks up at 25% CPU usage and won't die
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-02 11:24 UTC by Filip Fila
Modified: 2020-01-30 12:32 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
PDF endless CPU usage (1.09 MB, application/pdf)
2020-01-29 11:55 UTC, Martin Bednar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Fila 2018-07-02 11:24:18 UTC
After some scrolling action in Okular, some pages will simply not render anymore.

Test document (from another bug report): https://bugs.kde.org/attachment.cgi?id=109856

Proof 1: https://i.imgur.com/hFSZ0FQ.png
Proof 2: https://i.imgur.com/15RRA7s.png

What happens as well is that CPU usage is locked to 25% consistently. You can't close out the program anymore, the process is still alive and eating up resources. 

Proof: https://i.imgur.com/xOLnDSt.jpg

Reproducibility: I reproduced this fairly easily 3 or 4 times with this document, but I can't say anything more specific except that it happens after some scrolling action. 

Maybe it's also good to add that I reproduced this while running Okular in the terminal and there was no output. 
______
KDE Plasma Version: 5.13.2
KDE Frameworks version: 5.47.0
Okular Version: 1.4.2
Qt Version: 5.11.1
OS: Manjaro
Comment 1 Filip Fila 2018-07-02 11:27:40 UTC
BTW the performance profile used was Normal.
Comment 2 Krešimir Čohar 2018-07-02 11:51:23 UTC
yeah the same thing happens to me in okular 1.4.2 with its memory usage set to "Low" (despite this, its memory usage slowly clambers up to a gig or so), except the CPU usage goes up to 40% or so, and it's intermittent hence hard to reproduce

if i use it for long enough, after a while it stops rendering pages
Comment 3 Albert Astals Cid 2018-07-03 22:29:01 UTC
Which poppler version does Manjaro use?

Can you record a video so i can see the kind of scrolling you do?
Comment 4 Filip Fila 2018-07-04 01:42:24 UTC
Poppler version is:  0.64.0-1

And here is the video: https://youtu.be/DCwekaSAnIk

It took me a while to get it to show up on recording... there is no sure-shot way of reproducing this. You can see that I was very aggressive with scrolling and zooming, but it can happen in a more of a real life situation. The 25% CPU lock-up and the process not dying are also shown in the video.
Comment 5 Christoph Feck 2018-07-31 01:23:02 UTC
Thanks for the update; changing status.
Comment 6 Filip Fila 2018-10-22 10:54:55 UTC
I had a lock up today reading a 15 page article and when I checked the system monitor Okular was again stuck at 25% CPU usage, with the ram spiking up to 2GB at that point (it's 160 MB with this document when there are no problems). It unfroze itself not long after though, maybe because it's not as demanding of a document.
Comment 7 Alexander Kandaurov 2019-01-05 10:21:31 UTC
I investigated this a bit and it looks like what causes the hang is the QTimer::singleShot() call from Generator::generatePixmap() which keeps an endless cycle of firing and resetting the same timer. I also experienced a hang once on closing a document (the window has closed but the process remained eating 25% of CPU) where it got stuck in DocumentPrivate::clearAndWaitForRequests() on loop.exec() call where it also kept firing that generatePixmap() timer.
Comment 8 Marko 2019-04-23 14:02:21 UTC
Happens here too.

Opening Okular either directly by clicking a pdf in Dolphin or via web browser does the same. After seemingly closing it it continues to run in the background consuming your cpu. I wouldn't even have noticed if hadn't a lot of transcodes running and they were going much slower than they should have been. After manually killing the Okular processes the resources they were consuming are released and everything works fine.

Arch Linux
KDE Plasma version: 5.15.4
KDE Frameworks Version: 5.57.0
Qt Version: 5.12.3
Kernel Version: 5.0.9-1-ck-haswell
OS Type: 64-bit


i5 4460 cpu
32GB ram
Comment 9 Filip Fila 2019-10-14 09:11:17 UTC
Still happens with Okular 1.8.2, Plasma 5.16.5, KF 5.62, Qt 5.13.1.
Comment 10 Jan Przybylak 2019-10-18 19:17:01 UTC
I can confirm this issue as well. When zooming in on a 4.7MiB, 2-page PDF containing a large bitmap image (it's a scan), everything becomes pixelated and stops loading. Okular's memory usage went up to over a gigabyte, with about 25% CPU usage as well. It also spawned a second process which was stuck at ~25% and didn't stop when I closed the window.

Running Okular from the terminal reveals that it somehow runs out of memory:

org.kde.okular.core: Running out of memory on page 1 (17333x25160 px);

This does not happen in other PDF readers like Xreader and Evince, which allow me to zoom in and move around all I want.
Comment 11 Albert Astals Cid 2019-10-25 21:07:57 UTC
I'm 93% sure this is a duplicate of 396137
Comment 12 Logan Rathbone 2019-12-04 03:41:41 UTC
I am not sure if this is the same, but I feel that I have experienced something similar for some time.

Sometimes, a documents just suddenly stops loading at a certain page number. I then close Okular, but the process continues to run, at 100% cpu usage. The only resolution appears to be to kill the process.
Comment 13 Xwang 2019-12-18 11:07:42 UTC
I have the same problem with some PDF with Arch linux.
Okular version 1.9.0
KDE Frameworks 5.64.0
Qt 5.13.2 (compiled with 5.13.2)
Comment 14 Martin Bednar 2020-01-29 11:55:51 UTC
Created attachment 125514 [details]
PDF endless CPU usage

I think I'm in the same boat with the attached PDF. Okular CPU usage never drops under 100% (on one core, I think it would take even more if it could)
After a few tries it rendered completely though (CPU usage not dropping)...

Poppler version 0.82.0
Okular 1.9.1 (kde-applications-19.12.1)
KDE Frameworks 5.66.0
Qt 5.13.2 (built against 5.13.2)
Comment 15 Tobias Deiminger 2020-01-30 08:59:29 UTC
Git commit 593803b0a1d98eba64aac38316aa521130b4ae78 by Tobias Deiminger.
Committed on 30/01/2020 at 08:15.
Pushed by aacid into branch 'release/19.12'.

Fix render stop and high load due to timing issue

Text generation is connected to pixmap generation thread started signal.
However the signal may have been emitted faster than the connect could took place,
and because started is fired only once, the connected lambda never got executed.

generatePixmap tried to sync up with that never happening text generation anyway
by means of scheduling itself. This lead to a infinite loop via a no more sleeping QEventLoop.

Fixed by moving the connect in front of starting the thread.
Related: bug 396137, bug 403643

M  +2    -2    core/generator.cpp

https://invent.kde.org/kde/okular/commit/593803b0a1d98eba64aac38316aa521130b4ae78
Comment 16 Martin Bednar 2020-01-30 12:32:56 UTC
Patched okular on my Gentoo.
Seems fixed.
Thank you! You made the day of at least 2 people :)