zathura
zathura copied to clipboard
Large PDF (ARMv8 reference manual) renders black pages with mupdf backend
On GitLab by @ddevault on Dec 15, 2022, 19:42
You may acquire this PDF (12,000 pages) here:
https://developer.arm.com/documentation/ddi0487/latest
On GitLab by @valoq on Jan 1, 2023, 01:56
Also reproducible with the poppler backend.
Opening the file in evince with the same poppler version works fine
While zathura just shows a black window when opening the file with zathura-pdf-poppler I could sometimes get the file to show by changing the window size. But even then the application was very slow in response to navigation.
When opening the file with zathura-pdf-mupdf, I also got the following errors multiple times:
warning: cannot load object (152728 0 R) into cache
error: calloc (1 x 80 bytes) failed
...
warning: cannot load object (152757 0 R) into cache
error: calloc (16 x 8 bytes) failed
warning: cannot load object (152757 0 R) into cache
error: malloc of 128 bytes failed
...
warning: cannot load object (33456 0 R) into cache
error: calloc (4104 x 1 bytes) failed
error: aborting process from uncaught error!
Note that the file opens correctly in Mupdf as well
On GitLab by @andipersti on Apr 29, 2023, 18:11
I think I've tracked down the problem to a limitation of the cairo library GTK uses for drawing the widgets.
Zathura basically concatenates all pages of a document into a single big image (in case of the ARM manual the resulting image is about 12.000.000 pixels high in the default zoom level) and uses a sliding window for showing the current view. Now during the GTK drawing process in gtk_widget_draw_internal
that "clip box" is calculated with cairo_rectangle
which uses _cairo_fixed_from_double
for converting the coordinates into the internal fixed-point representation. And this conversion overflows for values bigger than 8.300.000. So the "clip box" will be empty and as a consequence gdk_cairo_get_clip_rectangle
will return nothing (i.e. an empty box) and the widget won't be drawn.
On GitLab by @AlexRevo on Apr 13, 2024, 12:43
Ran into what seems like this issue, too: if I zoom out enough, the document renders, but at this point the text is too small to be readable.
Document link: https://www.japonski-pomocnik.pl/wordDictionary/dictionary.pdf (8990 pages).
I can confirm that I experience the same issue with big documents (~7000 pages). And like said before it doesn't matter if I use poppler or mupdf backend.
I am experiencing similar issues. I was also trying to view that same ARMv8 reference that lead me here. I can't see any pages until about page 6000 or so when it does finally render a page. However, when first opening the document, if I switch to dual page view then all pages are rendered. Albeit performance is bad. Scrolling with j and k has significant lag and paging forward and backward takes about one second. Toggling dual page view renders either nothing or the current two pages.
I've reported Debian bug 1079283, which occurred on the "Intel® 64 and IA-32 Architectures Software Developer's Manual" (almost the same PDF file as in #65, as it has been updated over the years). This is with Debian's package, thus with the poppler backend.
As I've said in #65, for me, only the first dozens/hundreds of pages appear as black (in particular, I could notice this by typing the [End]
key). This is basically what @austinmlv said last week.
Once the issue occurred, it occurred every time: it seems that the .local/share/zathura/bookmarks.sqlite
file got somewhat corrupt. When I tried again with a clean .local/share/zathura
directory, I couldn't reproduce the issue.
With the PDF file at https://developer.arm.com/documentation/ddi0487/latest I could also reproduce the issue (without firejail, contrary to what occurred for the bug I had reported in the Debian BTS). Like what has been said, when switching to dual page view, I could see all the pages rendered as expected, but this is very slow. Moreover, with the window extended to the maximum size on a 4K monitor and "Adjust window in width mode" (key s
), this triggers OOM because it needs around 20 GB:
Aug 22 13:10:11 qaa kernel: oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/user.slice/user-1000.slice/session-2.scope,task=zathura,pid=96962,uid=1000
Aug 22 13:10:11 qaa kernel: Out of memory: Killed process 96962 (zathura) total-vm:23555992kB, anon-rss:22594056kB, file-rss:13256kB, shmem-rss:30820kB, UID:1000 pgtables:45408kB oom_score_adj:0