Bug 200125

Summary: (steps,testcase) Dolphin crashed entering folder (QUrl, KFilePreviewGenerator::Private::delayedIconUpdate)
Product: [Applications] dolphin Reporter: Craig Magina <craig.magina>
Component: generalAssignee: Peter Penz <peter.penz19>
Status: RESOLVED FIXED    
Severity: crash CC: 65prophecy, abbadon80, alberich, andresbajotierra, andresrh2000, andrev2, arunmarjun, blitz00, carmack, cniehaus, darthsteel, e.lex, finex, frank78ac, gary, gatoso, gjaviergr, jerome.multrier, jo.oiongen, joshlukas, jrodrigomd, juan_aguilar, kde, loacoon, madnux, michelange, mola89, mw, p.a.s, p.garcifer, pasnox, richts, shivrang.setlur, sputnikshock, strikeapope, thomas.b.pringle, thomasj, tiger_vision2036, tim474, trotos, tuxerito, wanker_trash-stuff, x545, zdenek.zikan
Priority: NOR Keywords: testcase
Version: 16.12.2   
Target Milestone: ---   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Craig Magina 2009-07-14 05:19:06 UTC
Application that crashed: dolphin
Version of the application: 1.3
KDE Version: 4.2.96 (KDE 4.2.96 (KDE 4.3 RC2))
Qt Version: 4.5.2
Operating System: Linux 2.6.30-8-generic x86_64
Distribution: Ubuntu karmic (development branch)

 -- Backtrace:
Application: Dolphin (dolphin), signal: Segmentation fault
[KCrash Handler]
#5  QUrl (this=0x7fff321c3590, other=...) at io/qurl.cpp:3936
#6  0x00007f51ecd15999 in KUrl (this=0x7fff321c3590, _u=...) at ../../kdecore/io/kurl.cpp:468
#7  0x00007f51eebb4540 in KFileItem::url (this=<value optimized out>) at ../../kio/kio/kfileitem.cpp:1268
#8  0x00007f51eeba4ed4 in KDirModel::indexForItem (this=0xb14b90, item=...) at ../../kio/kio/kdirmodel.cpp:919
#9  0x00007f51ee84a92b in KFilePreviewGenerator::Private::orderItems (this=0x8b3d30, items=...) at ../../kfile/kfilepreviewgenerator.cpp:1013
#10 0x00007f51ee84e442 in KFilePreviewGenerator::Private::updateIcons (this=0x8b3d30, items=...) at ../../kfile/kfilepreviewgenerator.cpp:501
#11 0x00007f51ee84e69f in KFilePreviewGenerator::Private::delayedIconUpdate (this=0x8b3d30) at ../../kfile/kfilepreviewgenerator.cpp:1078
#12 0x00007f51ee84f565 in KFilePreviewGenerator::qt_metacall (this=0x194d1a0, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fff321c38b0) at ./kfilepreviewgenerator.moc:95
#13 0x00007f51ebb26e1c in QMetaObject::activate (sender=0xfc8850, from_signal_index=<value optimized out>, to_signal_index=<value optimized out>, argv=0x2bd) at kernel/qobject.cpp:3113
#14 0x00007f51ebb20dc3 in QObject::event (this=0xfc8850, e=0x10) at kernel/qobject.cpp:1075
#15 0x00007f51ebfa462c in QApplicationPrivate::notify_helper (this=0x8b4d10, receiver=0xfc8850, e=0x7fff321c3eb0) at kernel/qapplication.cpp:4056
#16 0x00007f51ebfab8fe in QApplication::notify (this=0x7fff321c4200, receiver=0xfc8850, e=0x7fff321c3eb0) at kernel/qapplication.cpp:4021
#17 0x00007f51ed2d23f6 in KApplication::notify (this=0x7fff321c4200, receiver=0xfc8850, event=0x7fff321c3eb0) at ../../kdeui/kernel/kapplication.cpp:302
#18 0x00007f51ebb11c6c in QCoreApplication::notifyInternal (this=0x7fff321c4200, receiver=0xfc8850, event=0x7fff321c3eb0) at kernel/qcoreapplication.cpp:610
#19 0x00007f51ebb3c912 in QCoreApplication::sendEvent (this=0x8b7f80) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:213
#20 QTimerInfoList::activateTimers (this=0x8b7f80) at kernel/qeventdispatcher_unix.cpp:572
#21 0x00007f51ebb3a2ad in timerSourceDispatch (source=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:165
#22 0x00007f51e784a9fe in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#23 0x00007f51e784e3c8 in ?? () from /usr/lib/libglib-2.0.so.0
#24 0x00007f51e784e4f0 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#25 0x00007f51ebb3a1f6 in QEventDispatcherGlib::processEvents (this=0x88eb50, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:327
#26 0x00007f51ec038ace in QGuiEventDispatcherGlib::processEvents (this=0x7fff321c3590, flags=<value optimized out>) at kernel/qguieventdispatcher_glib.cpp:202
#27 0x00007f51ebb10572 in QEventLoop::processEvents (this=<value optimized out>, flags=) at kernel/qeventloop.cpp:149
#28 0x00007f51ebb10944 in QEventLoop::exec (this=0x7fff321c4150, flags=) at kernel/qeventloop.cpp:201
#29 0x00007f51ebb12af9 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:888
#30 0x0000000000439345 in _start ()

Reported using DrKonqi
Comment 1 FiNeX 2009-07-14 11:24:21 UTC
Did you browse the network or did you manually enter the URI of the smb share?
Comment 2 FiNeX 2009-07-14 11:26:25 UTC
Anyway the backtrace is very similar to bug 199618.
Comment 3 Dario Andres 2009-07-14 15:03:51 UTC
Indeed, it is also related to bug 193466.
Comment 4 Dario Andres 2009-07-31 15:42:06 UTC
*** Bug 200714 has been marked as a duplicate of this bug. ***
Comment 5 Dario Andres 2009-07-31 15:42:22 UTC
*** Bug 201957 has been marked as a duplicate of this bug. ***
Comment 6 Dario Andres 2009-08-01 16:56:30 UTC
*** Bug 201544 has been marked as a duplicate of this bug. ***
Comment 7 Dario Andres 2009-08-05 15:43:22 UTC
*** Bug 202464 has been marked as a duplicate of this bug. ***
Comment 8 Dario Andres 2009-08-07 00:15:47 UTC
*** Bug 202768 has been marked as a duplicate of this bug. ***
Comment 9 Dario Andres 2009-08-07 00:27:36 UTC
I managed to identify some testcase steps thanks to the help of the reporter of bug 202768.

You will need:
- A mostly clean Dolphin configuration (may be optional)
- A script or application that writes data to a file every certain seconds. (In this case, we could use a python script provided at bug 202768 comment 3 (https://bugs.kde.org/attachment.cgi?id=35936) , it writes 1024bytes of random data to a file every second)

Steps
- Close the Dolphin instances you have open (and clean/move your config "dolphinrc")
- Create a test folder (I'm going to call it "TESTDIR")
- Copy the python script to that folder
- Run Konsole, chdir to TESTDIR and launch Dolphin to show that folder (ex. "dolphin .")
Dolphin should start and show TESTDIR contents
- Select Details View (this may be irrelevant; it's the default here)
- Activate the Preview Mode using the button in the toolbar
- Reduce the size of the preview to the minimum (this may be irrelevant)
- Now, run the python app from Konsole.
The file «file to make dolphin crash.zip.part» should appear and should start growing 1kb per second.
- Wait until it has 9Kb or 10Kb (after 9 or 10 seconds).
- Now click on the KUrlNavigator to make it editable; add "/*.*" to the end (now the path will be "TESTDIR/*.*") and press Enter.
- If your mouse is over the KUrlNavigator, move it to the central view  (which is empty because the path is indeed invalid; we will also get an error in the status bar).
- Leave the mouse there and wait.
After 5 seconds ~ Dolphin will crash with the mentioned backtrace.
- If Dolphin does not crash just move the mouse cursor position between the KUrlNavigator (which is still in the editable mode) and the main directory view.

If you can't reproduce, may be you have to clean configs and start over again. I can reproduce mostly all the times with the described tests (however may be there are useless steps, or missing required information.. just ask)

BTW, I can reproduce using:

Qt: 4.5.2 (KDE-Qt git commit f9802f2bbbd23137acb5f80d1f131fa6b1a85752
        Date:   Fri Jun 12 15:06:29 2009 +0200)
KDE: 4.3.62 (KDE 4.3.62 (KDE 4.4 >= 20090728))
kdelibs svn rev. 1006918 / kdebase svn rev. 1006918
on ArchLinux i686 - Kernel 2.6.30.4
Comment 10 Dario Andres 2009-08-07 00:29:48 UTC
Updated backtrace:

Application: Dolphin (dolphin), signal: Segmentation fault
[KCrash Handler]
#6  0xb644226b in QUrl (this=0xbf939d18, other=@0x8) at io/qurl.cpp:3936
#7  0xb7256a49 in KUrl (this=0xbf939d18, _u=@0x8) at /home/kde-devel/kde/src/KDE/kdelibs/kdecore/io/kurl.cpp:472
#8  0xb7ec447e in KFileItem::url (this=0x86cbe38) at /home/kde-devel/kde/src/KDE/kdelibs/kio/kio/kfileitem.cpp:1274
#9  0xb7eb235f in KDirModel::indexForItem (this=0x86f16f8, item=@0x86cbe38) at /home/kde-devel/kde/src/KDE/kdelibs/kio/kio/kdirmodel.cpp:919
#10 0xb7d824f6 in KFilePreviewGenerator::Private::orderItems (this=0x87f7058, items=@0xbf939e3c) at /home/kde-devel/kde/src/KDE/kdelibs/kfile/kfilepreviewgenerator.cpp:1014
#11 0xb7d860dd in KFilePreviewGenerator::Private::updateIcons (this=0x87f7058, items=@0xbf939e9c) at /home/kde-devel/kde/src/KDE/kdelibs/kfile/kfilepreviewgenerator.cpp:508
#12 0xb7d86322 in KFilePreviewGenerator::Private::delayedIconUpdate (this=0x87f7058) at /home/kde-devel/kde/src/KDE/kdelibs/kfile/kfilepreviewgenerator.cpp:1079
#13 0xb7d87396 in KFilePreviewGenerator::qt_metacall (this=0x87f6e80, _c=QMetaObject::InvokeMetaMethod, _id=14, _a=0xbf939f38)
    at /home/kde-devel/kde/build/KDE/kdelibs/kfile/kfilepreviewgenerator.moc:95
#14 0xb64a69ca in QMetaObject::activate (sender=0x87f7598, from_signal_index=4, to_signal_index=4, argv=0x0) at kernel/qobject.cpp:3112
#15 0xb64a6d42 in QMetaObject::activate (sender=0x87f7598, m=0xb65b5be4, local_signal_index=0, argv=0x0) at kernel/qobject.cpp:3186
#16 0xb64eb00f in QTimer::timeout (this=0x87f7598) at .moc/debug-shared/moc_qtimer.cpp:128
#17 0xb64af5de in QTimer::timerEvent (this=0x87f7598, e=0xbf93a4b4) at kernel/qtimer.cpp:261
#18 0xb64a2be2 in QObject::event (this=0x87f7598, e=0xbf93a4b4) at kernel/qobject.cpp:1074
#19 0xb672800b in QApplicationPrivate::notify_helper (this=0x8671c40, receiver=0x87f7598, e=0xbf93a4b4) at kernel/qapplication.cpp:4056
#20 0xb672646c in QApplication::notify (this=0xbf93a80c, receiver=0x87f7598, e=0xbf93a4b4) at kernel/qapplication.cpp:3603
#21 0xb764c0aa in KApplication::notify (this=0xbf93a80c, receiver=0x87f7598, event=0xbf93a4b4) at /home/kde-devel/kde/src/KDE/kdelibs/kdeui/kernel/kapplication.cpp:302
#22 0xb648d1c1 in QCoreApplication::notifyInternal (this=0xbf93a80c, receiver=0x87f7598, event=0xbf93a4b4) at kernel/qcoreapplication.cpp:610
#23 0xb6719741 in QCoreApplication::sendEvent (receiver=0x87f7598, event=0xbf93a4b4) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:213
#24 0xb64c4672 in QTimerInfoList::activateTimers (this=0x866a754) at kernel/qeventdispatcher_unix.cpp:572
#25 0xb64c0b17 in timerSourceDispatch (source=0x866a720) at kernel/qeventdispatcher_glib.cpp:165
#26 0xb5c86d98 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#27 0xb5c8a3e0 in g_main_context_iterate () from /usr/lib/libglib-2.0.so.0
#28 0xb5c8a513 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#29 0xb64c1a5a in QEventDispatcherGlib::processEvents (this=0x8668af0, flags={i = 36}) at kernel/qeventdispatcher_glib.cpp:327
#30 0xb67d9c6e in QGuiEventDispatcherGlib::processEvents (this=0x8668af0, flags={i = 36}) at kernel/qguieventdispatcher_glib.cpp:202
#31 0xb648a79f in QEventLoop::processEvents (this=0xbf93a75c, flags={i = 36}) at kernel/qeventloop.cpp:149
#32 0xb648a8e4 in QEventLoop::exec (this=0xbf93a75c, flags={i = 0}) at kernel/qeventloop.cpp:201
#33 0xb648d89d in QCoreApplication::exec () at kernel/qcoreapplication.cpp:888
#34 0xb6726128 in QApplication::exec () at kernel/qapplication.cpp:3525
#35 0x08079605 in main (argc=2, argv=0xbf93a9e4) at /home/kde-devel/kde/src/KDE/kdebase/apps/dolphin/src/main.cpp:94
Comment 11 Dario Andres 2009-08-07 20:46:49 UTC
*** Bug 202828 has been marked as a duplicate of this bug. ***
Comment 12 Dario Andres 2009-08-09 16:02:46 UTC
*** Bug 203141 has been marked as a duplicate of this bug. ***
Comment 13 Dario Andres 2009-08-12 16:23:11 UTC
*** Bug 203519 has been marked as a duplicate of this bug. ***
Comment 14 Frank Reininghaus 2009-08-13 23:25:08 UTC
*** Bug 203728 has been marked as a duplicate of this bug. ***
Comment 15 Dario Andres 2009-08-19 22:16:23 UTC
*** Bug 204447 has been marked as a duplicate of this bug. ***
Comment 16 Dario Andres 2009-08-23 00:32:34 UTC
*** Bug 204799 has been marked as a duplicate of this bug. ***
Comment 17 Dario Andres 2009-08-25 03:25:16 UTC
*** Bug 204995 has been marked as a duplicate of this bug. ***
Comment 18 Frank Reininghaus 2009-08-27 11:19:01 UTC
*** Bug 205308 has been marked as a duplicate of this bug. ***
Comment 19 Dario Andres 2009-08-30 17:08:00 UTC
*** Bug 205695 has been marked as a duplicate of this bug. ***
Comment 20 Frank Reininghaus 2009-09-01 10:49:51 UTC
*** Bug 205860 has been marked as a duplicate of this bug. ***
Comment 21 Dario Andres 2009-09-02 20:35:04 UTC
*** Bug 206029 has been marked as a duplicate of this bug. ***
Comment 22 Dario Andres 2009-09-02 22:25:11 UTC
*** Bug 206044 has been marked as a duplicate of this bug. ***
Comment 23 Dario Andres 2009-09-04 00:44:07 UTC
*** Bug 206139 has been marked as a duplicate of this bug. ***
Comment 24 Dario Andres 2009-09-04 23:01:27 UTC
*** Bug 206286 has been marked as a duplicate of this bug. ***
Comment 25 Dario Andres 2009-09-05 02:56:15 UTC
*** Bug 206302 has been marked as a duplicate of this bug. ***
Comment 26 Frank Reininghaus 2009-09-08 10:19:07 UTC
*** Bug 206706 has been marked as a duplicate of this bug. ***
Comment 27 Frank Reininghaus 2009-09-08 22:26:45 UTC
*** Bug 206765 has been marked as a duplicate of this bug. ***
Comment 28 Frank Reininghaus 2009-09-10 19:40:37 UTC
*** Bug 206899 has been marked as a duplicate of this bug. ***
Comment 29 Frank Reininghaus 2009-09-10 20:28:39 UTC
@Peter: The code that causes this crash was committed in

http://websvn.kde.org/?view=rev&revision=969368

Most reports seem to have in common that the URL of the current view was changed after or during a huge copy operation, and then Dolphin crashes. What I think might be happening (without really knowing the internals):

1. The file data change during the copy operation. KDirModel emits dataChanged(const QModelIndex&, const QModelIndex&), which is connected to

KFilePreviewGenerator::Private::updateIcons(const QModelIndex&, const QModelIndex&)

In that function, the 5 seconds timer m_changedItemsTimer gets started.

2. The URL of the current view changes.

3. After 5 seconds, the timer expires and calls KFilePreviewGenerator::Private::delayedIconUpdate(). That ends up in KFilePreviewGenerator::Private::orderItems(KFileItemList& items), which calls KDirModel::indexForItem(const KFileItem& item) to get the item's model index. But it seems that the item is not really valid any more (because of the URL change), and trying to find out its URL leads to a segfault.

Maybe one could somehow stop the timer if the URL of the current view changes, or KFilePreviewGenerator::Private::delayedIconUpdate() could check if the URL has changed in the meantime and just return without doing anything if that is the case. I haven't had the time to try that yet, though.

In any case, I think this should be fixed or that commit reverted before 4.3.2. It looks like this regression causes more trouble than bug 168666 which is fixed by it ;-)
Comment 30 Peter Penz 2009-09-10 20:32:50 UTC
Thanks Frank for the analyses, I'll try to fix this issue until the end of the week and backport it to KDE 4.3.x :-) It was on my radar already because of the huge number of duplicates, but did not have the time yet to analyze it... :-(
Comment 31 Peter Penz 2009-09-10 22:45:02 UTC
SVN commit 1022119 by ppenz:

When KFilePreviewGenerator::Private::killPreviewJobs() is invoked, all timers must get stopped to. Otherwise it is possible that a timer like m_changedItemsTimer will invoke orderItems() on an already invalid URL which will result in a crash.

Thanks a lot to Frank Reininghaus for the analyses and Dario Andres & FiNeX for taking care to recognize the huge number of duplicates.

BUG: 200125

 M  +4 -0      kfilepreviewgenerator.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1022119
Comment 32 Peter Penz 2009-09-10 22:47:25 UTC
SVN commit 1022120 by ppenz:

Backport of SVN commit 1022119: When KFilePreviewGenerator::Private::killPreviewJobs() is invoked, all timers
must get stopped to. Otherwise it is possible that a timer like m_changedItemsTimer will invoke orderItems() on an already invalid URL which
will result in a crash.

Thanks a lot to Frank Reininghaus for the analyses and Dario Andres & FiNeX for taking care to recognize the huge number of duplicates.

CCBUG: 200125


 M  +4 -0      kfilepreviewgenerator.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1022120
Comment 33 Frank Reininghaus 2009-09-11 09:14:40 UTC
*** Bug 206925 has been marked as a duplicate of this bug. ***
Comment 34 Frank Reininghaus 2009-09-11 09:16:28 UTC
*** Bug 199618 has been marked as a duplicate of this bug. ***
Comment 35 Frank Reininghaus 2009-09-11 09:21:47 UTC
*** Bug 207009 has been marked as a duplicate of this bug. ***
Comment 36 Frank Reininghaus 2009-09-11 09:25:46 UTC
*** Bug 198120 has been marked as a duplicate of this bug. ***
Comment 37 Frank Reininghaus 2009-09-13 22:09:53 UTC
*** Bug 207277 has been marked as a duplicate of this bug. ***
Comment 38 Frank Reininghaus 2009-09-14 10:01:57 UTC
*** Bug 207313 has been marked as a duplicate of this bug. ***
Comment 39 Frank Reininghaus 2009-09-15 21:39:21 UTC
*** Bug 207455 has been marked as a duplicate of this bug. ***
Comment 40 Dario Andres 2009-09-16 15:42:18 UTC
*** Bug 207536 has been marked as a duplicate of this bug. ***
Comment 41 Frank Reininghaus 2009-09-21 13:06:19 UTC
*** Bug 208074 has been marked as a duplicate of this bug. ***
Comment 42 Frank Reininghaus 2009-09-23 10:22:02 UTC
*** Bug 208240 has been marked as a duplicate of this bug. ***
Comment 43 Frank Reininghaus 2009-09-25 23:14:00 UTC
*** Bug 208556 has been marked as a duplicate of this bug. ***
Comment 44 Dario Andres 2009-09-30 13:58:54 UTC
*** Bug 208980 has been marked as a duplicate of this bug. ***
Comment 45 Dario Andres 2009-09-30 14:02:02 UTC
*** Bug 208895 has been marked as a duplicate of this bug. ***
Comment 46 Dario Andres 2009-10-02 03:56:27 UTC
*** Bug 209166 has been marked as a duplicate of this bug. ***
Comment 47 Dario Andres 2009-10-03 18:55:20 UTC
*** Bug 209257 has been marked as a duplicate of this bug. ***
Comment 48 Dario Andres 2009-10-04 23:40:24 UTC
*** Bug 209461 has been marked as a duplicate of this bug. ***
Comment 49 Dario Andres 2009-10-07 02:20:28 UTC
*** Bug 209691 has been marked as a duplicate of this bug. ***
Comment 50 Dario Andres 2009-10-09 14:11:31 UTC
*** Bug 209958 has been marked as a duplicate of this bug. ***
Comment 51 Frank Reininghaus 2009-10-26 16:15:49 UTC
*** Bug 211942 has been marked as a duplicate of this bug. ***
Comment 52 Dario Andres 2009-12-24 20:32:31 UTC
*** Bug 219993 has been marked as a duplicate of this bug. ***