document opening hangs depending on order of opening

Bug #1907459 reported by Mark Brooker
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
qpdfview
Incomplete
Undecided
Unassigned

Bug Description

Using qpdfview 0.4.18 on MX-Linux 18.3

It used to be possible to open any number of simple/complex documents in any order. Recently the program has started "hanging" on opening a second or subsequent document, especially if it is a "complex" document. By hanging I mean the document fails to render while CPU use is at 100%. The whole window goes unresponsive, it's not possible to switch tabs, close tabs or close the program. Only a kill -9 terminates it.

To demonstrate try opening the attached complex1.pdf followed by EX-17.pdf from a file manager, or using "File/Open in new tab", or at the same time from a command line by ```qpdfview complex1.pdf EX-17.pdf```

Killing the program and opening them in the opposite order works OK.

If the files are all "simple", for example the attached simple1.pdf and simple2.pdf then there is no problem opening as many as desired in any order, eg: simple1, simple2, complex1 is OK, try adding EX-17 and it hangs. The problem is not with EX-17.pdf itself, that's just one of many files which demonstrate the problem.

Machine is Core i5 with 16GB RAM and not resource constrained when opening the files.

Possibly a consequence of updating some packages on 11/11/20 including
```libpoppler-glib8 (0.48.0-2+deb9u3) to 0.48.0-2+deb9u4
libpoppler-qt5-1 (0.48.0-2+deb9u3) to 0.48.0-2+deb9u4
libpoppler64 (0.48.0-2+deb9u3) to 0.48.0-2+deb9u4
...
poppler-utils (0.48.0-2+deb9u3) to 0.48.0-2+deb9u4```

Attaching gdb to a "hung" qpdfview shows it in different places at different times, see the gdb1.txt and gdb2.txt backtraces.

Problem doesn't repro in an MX-19 VM with qpdfview 0.4.17.99
Problem doesn't repro in a Xubuntu 18.04 VM with qpdfview 0.4.14

Revision history for this message
Mark Brooker (walkjivefly) wrote :
Revision history for this message
Adam Reichold (adamreichold) wrote :

Hello Mark,

thank you for preparing this detailed bug report! Sadly, I have not been able to reproduce the hang so far. The backtraces are sadly often not helpful as they just contain a lot of generic Qt event processing functions. But since you are able to use gdb, would you be willing to dig into this further and using e.g. "perf top -p $(pidof qpdfview)" [1] to collect a profile during such a hang? This might help us to better isolate which part of the code base is hogging the CPU.

Best regards,
Adam

[1] https://jvns.ca/blog/2016/02/24/perf-top-my-new-best-friend/

Changed in qpdfview:
status: New → Incomplete
Revision history for this message
Mark Brooker (walkjivefly) wrote :
Download full text (3.8 KiB)

Hi Adam,

Happy to try to help, qpdfview is far too useful to me to have it broken! Even if it's not actually qpdfview which is broken ;-)

Here's the perf output

Samples: 210K of event 'cycles:ppp', Event count (approx.): 41049915900
Overhead Shared Object Symbol
  89.79% libQt5Widgets.so.5.7.1 [.] QApplication::compressEvent
   0.31% libQt5Widgets.so.5.7.1 [.] QWidgetPrivate::isOverlapped
   0.18% [kernel] [k] task_tick_fair
   0.15% [kernel] [k] nmi
   0.15% libglib-2.0.so.0.5600.1 [.] g_hash_table_lookup
   0.14% libQt5Core.so.5.7.1 [.] QCoreApplication::postEvent
   0.14% libQt5Core.so.5.7.1 [.] QMetaObject::activate
   0.13% libc-2.24.so [.] _int_malloc
   0.12% libQt5Gui.so.5.7.1 [.] QAccessible::queryAccessibleInterface
   0.11% libgobject-2.0.so.0.5600.1 [.] g_type_check_instance_is_a
   0.09% [kernel] [k] update_curr
   0.09% libstdc++.so.6.0.22 [.] operator delete@plt
   0.08% libQt5Widgets.so.5.7.1 [.] QWidget::window
   0.08% [kernel] [k] timerqueue_add
   0.07% libc-2.24.so [.] malloc
   0.07% libQt5Core.so.5.7.1 [.] QMetaObject::methodOffset
   0.07% libQt5Core.so.5.7.1 [.] QCoreApplicationPrivate::sendThroughA
   0.07% [kernel] [k] cpuacct_account_field
   0.07% libQt5Widgets.so.5.7.1 [.] QApplication::notify
   0.06% libQt5Widgets.so.5.7.1 [.] QAbstractSlider::setRange
   0.06% libgtk-x11-2.0.so.0.2400.31 [.] gtk_widget_get_style
   0.06% libgtk-x11-2.0.so.0.2400.31 [.] gtk_widget_style_get_valist
   0.06% [kernel] [k] switch_to_thread_stack
   0.06% libgtk-x11-2.0.so.0.2400.31 [.] gtk_widget_style_get
   0.06% libQt5Widgets.so.5.7.1 [.] QGraphicsViewPrivate::recalculateCont
   0.06% libqgtk2style.so [.] 0x00000000000287c8
   0.06% [unknown] [k] 0xfffffe000008a01b
   0.05% libQt5Widgets.so.5.7.1 [.] QApplicationPrivate::notify_helper
   0.05% libgobject-2.0.so.0.5600.1 [.] g_param_spec_pool_lookup
   0.05% libc-2.24.so [.] _int_free
   0.05% [kernel] [k] __fget
   0.05% libc-2.24.so [.] free
   0.05% libqgtk2style.so [.] 0x0000000000028764
   0.05% libQt5Widgets.so.5.7.1 [.] QAbstractScrollAreaPrivate::layoutChi
   0.05% libQt5Widgets.so.5.7.1 [.] QWidget::testAttribute_helper
   0.05% libQt5Widgets.so.5.7.1 [.] QWidget::setVisible
   0.05% libQt5Widgets.so.5.7.1 [.] QWidget::isActiveWindow
   0.05% libQt5Widgets.so.5.7.1 [.] QWidget::graphicsEffect
   0.05% libQt5Widgets.so.5.7.1 [.] QWidgetPrivate::invalidateBuffer_resi
   0.05% libQt5Widgets.so.5.7.1 [.] QCommonStyle::styleHint
   0.05% libQt5Widgets.so.5.7.1 [.] QWidget::event
   0.05% libQt5Widgets.so.5.7.1 [.] QGraphicsItem::prepareGeometryChange
   0.04% libQt5Core.so.5.7.1 [.] QMutex::lock
   0.04% libQt5Core.so.5.7.1 [.] QCoreApplication::notifyInternal2
   0.04% [kernel] ...

Read more...

Revision history for this message
Adam Reichold (adamreichold) wrote :

Hello again,

I have to admit to not having a good idea yet. I will try reading up on Qt's event compression which is new to me.

One thing that you could try even it is a shot into the dark is to stash away qpdfview's database at ~/.local/share/qpdfview/qpdfview/database to reset its per-file settings and try to open the file with a fixed scale factor like 100% instead of the fit-to-* scale modes. This is based on seeing stuff related to QGraphicsItem in the backtrace and profile.

Best regards,
Adam

Revision history for this message
Mark Brooker (walkjivefly) wrote :

Genius! Opening simple1.pdf, setting the scale to 100% and then opening in new tab EX-17.pdf works. Thereafter opening any other "complex" file works, changing the zoom works, variable scales like "page size" work too. I'll fiddle with it some more and see if I can pin down more closely what has changed on my machine to be causing this. In over a year of using qpdfview I've only seen the problem in the last couple of days.

Revision history for this message
Mark Brooker (walkjivefly) wrote :

I have the impression that binning the sqllite database and starting again with a clean new one was the solution.

Thanks for the very quick response, Adam.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.