Bug 212066 - okular crashed after automatic reload of file
Summary: okular crashed after automatic reload of file
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Unlisted Binaries Linux
: NOR crash
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-27 16:31 UTC by Thomas Rehn
Modified: 2010-03-29 08:59 UTC (History)
1 user (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 Thomas Rehn 2009-10-27 16:31:21 UTC
Application that crashed: okular
Version of the application: 0.9.2
KDE Version: 4.3.2 (KDE 4.3.2)
Qt Version: 4.5.2
Operating System: Linux 2.6.31-14-generic i686
Distribution: Ubuntu 9.10

What I was doing when the application crashed:
I edited a LaTeX document with Kile and had its DVI-output open in a Okular window. Shortly after one (not the first) automatic reload that was triggered by latex, okular segfaulted.

Besides this segfault I have observed a similar malfunction several times: the automatic reload did not work. I could also trigger the reload manually but the document wasn't reloaded (although it had changed). After closing the okular window the okular process was still running and I had to kill it manually. Then in a new Okular session everything worked fine for a undefined number of times before again reload didn't work.

 -- Backtrace:
Application: Okular (okular), signal: Segmentation fault
[KCrash Handler]
#6  0x0747937f in Okular::Page::setPixmap (this=0xa4c07f8, id=3, pixmap=0x9b55ed0) at ../../okular/core/page.cpp:421
#7  0x07476a15 in Okular::GeneratorPrivate::pixmapGenerationFinished (this=0x977ea40) at ../../okular/core/generator.cpp:102
#8  0x07476b91 in Okular::Generator::qt_metacall (this=0x9780480, _c=QMetaObject::InvokeMetaMethod, _id=8, _a=0x9f7f7a0) at ./generator.moc:82
#9  0x0199b992 in DviGenerator::qt_metacall (this=0x9780480, _c=QMetaObject::InvokeMetaMethod, _id=8, _a=0x9f7f7a0) at ./generator_dvi.moc:60
#10 0x00e34f0b in QMetaCallEvent::placeMetaCall (this=0x9cffb68, object=0x9780480) at kernel/qobject.cpp:477
#11 0x00e365fe in QObject::event (this=0x9780480, e=0x9cffb68) at kernel/qobject.cpp:1111
#12 0x0103af54 in QApplicationPrivate::notify_helper (this=0x9457320, receiver=0x9780480, e=0x9cffb68) at kernel/qapplication.cpp:4056
#13 0x0104267c in QApplication::notify (this=0xbfe57b38, receiver=0x9780480, e=0x9cffb68) at kernel/qapplication.cpp:3603
#14 0x008b6bfa in KApplication::notify (this=0xbfe57b38, receiver=0x9780480, event=0x9cffb68) at ../../kdeui/kernel/kapplication.cpp:302
#15 0x00e266cb in QCoreApplication::notifyInternal (this=0xbfe57b38, receiver=0x9780480, event=0x9cffb68) at kernel/qcoreapplication.cpp:610
#16 0x00e272b2 in QCoreApplication::sendEvent (receiver=0x0, event_type=0, data=0x9441e48) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:213
#17 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x9441e48) at kernel/qcoreapplication.cpp:1247
#18 0x00e2747d in QCoreApplication::sendPostedEvents (receiver=0x0, event_type=0) at kernel/qcoreapplication.cpp:1140
#19 0x00e513ff in QCoreApplication::sendPostedEvents (s=0x9459710) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:218
#20 postEventSourceDispatch (s=0x9459710) at kernel/qeventdispatcher_glib.cpp:210
#21 0x072cfe78 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#22 0x072d3720 in ?? () from /lib/libglib-2.0.so.0
#23 0x072d3853 in g_main_context_iteration () from /lib/libglib-2.0.so.0
#24 0x00e5102c in QEventDispatcherGlib::processEvents (this=0x9441a30, flags=...) at kernel/qeventdispatcher_glib.cpp:327
#25 0x010dbbe5 in QGuiEventDispatcherGlib::processEvents (this=0x9441a30, flags=...) at kernel/qguieventdispatcher_glib.cpp:202
#26 0x00e24c79 in QEventLoop::processEvents (this=0xbfe57a34, flags=) at kernel/qeventloop.cpp:149
#27 0x00e250ca in QEventLoop::exec (this=0xbfe57a34, flags=...) at kernel/qeventloop.cpp:201
#28 0x00e2753f in QCoreApplication::exec () at kernel/qcoreapplication.cpp:888
#29 0x0103add7 in QApplication::exec () at kernel/qapplication.cpp:3525
#30 0x0804eec9 in main (argc=2, argv=0xbfe57d24) at ../../../okular/shell/main.cpp:81

Reported using DrKonqi
Comment 1 Albert Astals Cid 2009-10-28 00:34:42 UTC
Does this happen with a particular dvi or all? Can you share one that has the problem?
Comment 2 Thomas Rehn 2009-10-28 11:56:52 UTC
I've notices this problem only with one specific dvi file, but this means nothing because I don't use reload on any other file.

It's difficult to reproduce the problem. I just has the situation that neither automatic nor manual reload worked on my dvi file and I had to kill okular again. After I restarted okular, both automatic reload (`touch`ing the file) and manual reload did work again.
Comment 3 Albert Astals Cid 2009-10-28 23:06:52 UTC
If you could share the file that generates the dvi it would be good since i've been trying to reach this state of reloading not working but i have not achieved it
Comment 4 Thomas Rehn 2009-11-09 21:17:36 UTC
By some kind of manual fuzzing (I ran latex on my existing document in an infinite loop and made parallel many changes to the document) I eventually managed to crash Okular during page reload.
One of the two crashes I was able to produce this way has a different stacktrace which I attach to this post.
If you like I can send you my LaTeX document that I have used to produce the crash by private email. I don't want it to be on the internet yet :)


Thread 1 (Thread 0xb785e700 (LWP 10689)):
[KCrash Handler]
#6  QBasicAtomicInt::operator!= (this=0xa39b7d0, job=0xa267470) at /usr/include/qt4/QtCore/qbasicatomic.h:69
#7  QMap<int, Okular::PagePrivate::PixmapObject>::detach (this=0xa39b7d0, job=0xa267470) at /usr/include/qt4/QtCore/qmap.h:172
#8  QMap<int, Okular::PagePrivate::PixmapObject>::find (this=0xa39b7d0, job=0xa267470) at /usr/include/qt4/QtCore/qmap.h:565
#9  Okular::PagePrivate::imageRotationDone (this=0xa39b7d0, job=0xa267470) at ../../okular/core/page.cpp:87
#10 0x0138b045 in Okular::PageController::imageRotationDone (this=0x9af5be8, j=0xa267470) at ../../okular/core/pagecontroller.cpp:53
#11 0x0138b12c in Okular::PageController::qt_metacall (this=0x9af5be8, _c=QMetaObject::InvokeMetaMethod, _id=5, _a=0xbfa53c18) at ./pagecontroller_p.moc:72
#12 0x00f7c263 in QMetaObject::activate (sender=0xa4d22b8, from_signal_index=6, to_signal_index=6, argv=0xbfa53c18) at kernel/qobject.cpp:3113
#13 0x00f7cec2 in QMetaObject::activate (sender=0xa4d22b8, m=0x10e2620, local_signal_index=2, argv=0xbfa53c18) at kernel/qobject.cpp:3187
#14 0x010d7833 in ThreadWeaver::WeaverInterface::jobDone (this=0xa4d22b8, _t1=0xa267470) at ./WeaverInterface.moc:99
#15 0x010d795f in ThreadWeaver::WeaverInterface::qt_metacall (this=0xa4d22b8, _c=QMetaObject::InvokeMetaMethod, _id=6, _a=0xbfa53d58) at ./WeaverInterface.moc:74
#16 0x010d7d22 in ThreadWeaver::Weaver::qt_metacall (this=0xa4d22b8, _c=QMetaObject::InvokeMetaMethod, _id=6, _a=0xbfa53d58) at ./ThreadWeaver.moc:58
#17 0x00f7c263 in QMetaObject::activate (sender=0x9d667c8, from_signal_index=6, to_signal_index=6, argv=0xbfa53d58) at kernel/qobject.cpp:3113
#18 0x00f7cec2 in QMetaObject::activate (sender=0x9d667c8, m=0x10e2620, local_signal_index=2, argv=0xbfa53d58) at kernel/qobject.cpp:3187
#19 0x010d7833 in ThreadWeaver::WeaverInterface::jobDone (this=0x9d667c8, _t1=0xa267470) at ./WeaverInterface.moc:99
#20 0x010d795f in ThreadWeaver::WeaverInterface::qt_metacall (this=0x9d667c8, _c=QMetaObject::InvokeMetaMethod, _id=6, _a=0xa4a2818) at ./WeaverInterface.moc:74
#21 0x010d83ea in ThreadWeaver::WeaverImpl::qt_metacall (this=0x9d667c8, _c=QMetaObject::InvokeMetaMethod, _id=6, _a=0xa4a2818) at ./WeaverImpl.moc:70
#22 0x00f74f0b in QMetaCallEvent::placeMetaCall (this=0xa2d04f0, object=0x9d667c8) at kernel/qobject.cpp:477
#23 0x00f765fe in QObject::event (this=0x9d667c8, e=0xa2d04f0) at kernel/qobject.cpp:1111
#24 0x088cdf54 in QApplicationPrivate::notify_helper (this=0x9a0e4f8, receiver=0x9d667c8, e=0xa2d04f0) at kernel/qapplication.cpp:4056
#25 0x088d567c in QApplication::notify (this=0xbfa545f8, receiver=0x9d667c8, e=0xa2d04f0) at kernel/qapplication.cpp:3603
#26 0x00830bfa in KApplication::notify (this=0xbfa545f8, receiver=0x9d667c8, event=0xa2d04f0) at ../../kdeui/kernel/kapplication.cpp:302
#27 0x00f666cb in QCoreApplication::notifyInternal (this=0xbfa545f8, receiver=0x9d667c8, event=0xa2d04f0) at kernel/qcoreapplication.cpp:610
#28 0x00f672b2 in QCoreApplication::sendEvent (receiver=0x0, event_type=0, data=0x99f8e48) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:213
#29 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x99f8e48) at kernel/qcoreapplication.cpp:1247
#30 0x00f6747d in QCoreApplication::sendPostedEvents (receiver=0x0, event_type=0) at kernel/qcoreapplication.cpp:1140
#31 0x00f913ff in QCoreApplication::sendPostedEvents (s=0x9a10910) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:218
#32 postEventSourceDispatch (s=0x9a10910) at kernel/qeventdispatcher_glib.cpp:210
#33 0x08597e78 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#34 0x0859b720 in ?? () from /lib/libglib-2.0.so.0
#35 0x0859b853 in g_main_context_iteration () from /lib/libglib-2.0.so.0
#36 0x00f9102c in QEventDispatcherGlib::processEvents (this=0x99f8a30, flags=...) at kernel/qeventdispatcher_glib.cpp:327
#37 0x0896ebe5 in QGuiEventDispatcherGlib::processEvents (this=0x99f8a30, flags=...) at kernel/qguieventdispatcher_glib.cpp:202
#38 0x00f64c79 in QEventLoop::processEvents (this=0xbfa544f4, flags=) at kernel/qeventloop.cpp:149
#39 0x00f650ca in QEventLoop::exec (this=0xbfa544f4, flags=...) at kernel/qeventloop.cpp:201
#40 0x00f6753f in QCoreApplication::exec () at kernel/qcoreapplication.cpp:888
#41 0x088cddd7 in QApplication::exec () at kernel/qapplication.cpp:3525
#42 0x0804eec9 in main (argc=5, argv=0xbfa547e4) at ../../../okular/shell/main.cpp:81
Comment 5 Albert Astals Cid 2009-11-09 22:24:36 UTC
do you have your document rotated from the original orientation?
Comment 6 Thomas Rehn 2009-11-09 22:36:02 UTC
No, it happened viewing a 'portrait'-style DVI file in (correct) 'portrait' orientation. I didn't change View/Orientation in Okular.
Comment 7 Albert Astals Cid 2009-11-10 20:23:53 UTC
Sorry to ask again, but are you sure?
The Okular::PageController::imageRotationDone part of your stack trace makes me think you are.
Are you sure you didn't rotate it once and forgot about it? What happens if you do View->Orientation->Original Orientation? Does it change the orientation?
Comment 8 Thomas Rehn 2009-11-10 20:57:50 UTC
I never rotated the document. When I clicked View/Orientation/Original Orientation nothing changed.

I have run some more fuzzing sessions and I got 2 crashes with the original stack trace of the bug and no crash with imageRotationDone. However, whenever fuzzing has not lead to a crash of Okular, it made the automatic reload stop and manual reload didn't work, as in the original description of this bug.
Comment 9 Albert Astals Cid 2009-11-10 21:54:28 UTC
Do you think you can create a script that automates the creation of the problem? Or else provide a very detailed step by step description of what you do to accomplish it?
Comment 10 Thomas Rehn 2009-11-10 22:27:13 UTC
I have now an automated version of my case with two scripts that run in parallel. One adds words to a LaTeX document every second, the other calls latex on the document in an infinite loop. 
Then I open the resulting DVI file and observe the crashes or the bug.

The crucial point is that I could not reproduce the bug with a "simple" document, containing only dummy text. As I already mentioned, I can provide the LaTeX document I work with by private email only, it is not ready for the internet yet.
Comment 11 Albert Astals Cid 2009-11-10 23:57:18 UTC
You can send it in private to me (tsdgeos@terra.es) and i promise to use it just to try to fix this bug and remove if afterwards.
Comment 12 Albert Astals Cid 2009-11-11 20:37:00 UTC
SVN commit 1047671 by aacid:

empty the pixmaps queue stack before doing the loop waiting for executing pixmap requests to empty, otherwise a single shot timed call to sendGeneratorRequest can kick us in the back cause bad things to happen, ranging from crashes to the app waiting forever in the loop
Patch provided by pino and tested by me
BUG: 212066


 M  +9 -8      document.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1047671
Comment 13 Albert Astals Cid 2009-11-11 20:39:35 UTC
SVN commit 1047675 by aacid:

backport r1047671 okular/trunk/KDE/kdegraphics/okular/core/document.cpp: 
empty the pixmaps queue stack before doing the loop waiting for executing pixmap
requests to empty, otherwise a single shot timed call to sendGeneratorRequest
can kick us in the back cause bad things to happen, ranging from crashes to the
app waiting forever in the loop
Patch provided by pino and tested by me
BUG: 212066


 M  +9 -8      document.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1047675
Comment 14 Vladimír Čunát 2010-03-29 08:59:54 UTC
In which release is the bug fixed? I probably reproduced it on 4.4.1. Couldn't it be connected to bug #232314?

Application: Okular (okular), signal: Segmentation fault
[KCrash Handler]
#6  0xb327af59 in Okular::Page::setPixmap (this=0x9c71050, id=4, pixmap=0xafa13488) at /var/tmp/paludis/kde-base-okular-4.4.1/work/okular-4.4.1/okular/core/page.cpp:426
#7  0xb32766b3 in Okular::GeneratorPrivate::pixmapGenerationFinished (this=0x999f078) at /var/tmp/paludis/kde-base-okular-4.4.1/work/okular-4.4.1/okular/core/generator.cpp:102
#8  0xb32767cb in Okular::Generator::qt_metacall (this=0x999de10, _c=QMetaObject::InvokeMetaMethod, _id=5, _a=0x99f75d0)
    at /var/tmp/paludis/kde-base-okular-4.4.1/work/okular-4.4.1_build/okular/generator.moc:93
#9  0xb1b2ef62 in DviGenerator::qt_metacall (this=0x999de10, _c=QMetaObject::InvokeMetaMethod, _id=9, _a=0x99f75d0)
    at /var/tmp/paludis/kde-base-okular-4.4.1/work/okular-4.4.1_build/okular/generators/dvi/generator_dvi.moc:66
#10 0xb6b461ed in QMetaObject::metacall (object=0xb6980ff4, cl=QMetaObject::InvokeMetaMethod, idx=9, argv=0x99f75d0) at kernel/qmetaobject.cpp:237
#11 0xb6b50974 in QMetaCallEvent::placeMetaCall (this=0x9d345a0, object=0x999de10) at kernel/qobject.cpp:561
#12 0xb6b51f43 in QObject::event (this=0x999de10, e=0x9d345a0) at kernel/qobject.cpp:1240
#13 0xb6013f1c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/qt4/libQtGui.so.4
#14 0xb601b98c in QApplication::notify(QObject*, QEvent*) () from /usr/lib/qt4/libQtGui.so.4
#15 0xb715d5ed in KApplication::notify (this=0xbfb16d30, receiver=0x999de10, event=0x9d345a0) at /var/tmp/paludis/kde-base-kdelibs-4.4.1-r1/work/kdelibs-4.4.1/kdeui/kernel/kapplication.cpp:302
#16 0xb6b40dc2 in QCoreApplication::notifyInternal (this=0xbfb16d30, receiver=0x999de10, event=0x9d345a0) at kernel/qcoreapplication.cpp:704
#17 0xb6b41cfe in QCoreApplication::sendEvent (receiver=0x0, event_type=0, data=0x9760038) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:215
#18 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x9760038) at kernel/qcoreapplication.cpp:1345
#19 0xb6b41ead in QCoreApplication::sendPostedEvents (receiver=0x0, event_type=0) at kernel/qcoreapplication.cpp:1238
#20 0xb6b6d47d in QCoreApplication::sendPostedEvents (s=0x97712a8) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:220
#21 postEventSourceDispatch (s=0x97712a8) at kernel/qeventdispatcher_glib.cpp:276
#22 0xb58d889f in g_main_dispatch (context=0x9770820) at gmain.c:1960
#23 IA__g_main_context_dispatch (context=0x9770820) at gmain.c:2513
#24 0xb58dc10b in g_main_context_iterate (context=0x9770820, block=1, dispatch=1, self=0x976dbc0) at gmain.c:2591
#25 0xb58dc298 in IA__g_main_context_iteration (context=0x9770820, may_block=1) at gmain.c:2654
#26 0xb6b6cf91 in QEventDispatcherGlib::processEvents (this=0x976e4e0, flags=...) at kernel/qeventdispatcher_glib.cpp:412
#27 0xb60d700a in ?? () from /usr/lib/qt4/libQtGui.so.4
#28 0xb6b3f3ea in QEventLoop::processEvents (this=0xbfb16ce0, flags=...) at kernel/qeventloop.cpp:149
#29 0xb6b3f84a in QEventLoop::exec (this=0xbfb16ce0, flags=...) at kernel/qeventloop.cpp:201
#30 0xb6b41f77 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:981
#31 0xb6013fc4 in QApplication::exec() () from /usr/lib/qt4/libQtGui.so.4
#32 0x0804f4e0 in main (argc=11154020, argv=0xb6f85d88) at /var/tmp/paludis/kde-base-okular-4.4.1/work/okular-4.4.1/okular/shell/main.cpp:82