Bug 278899 - dolphin hangs when I open /usr/lib/ and I click on 'details view mode'
Summary: dolphin hangs when I open /usr/lib/ and I click on 'details view mode'
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Unmaintained
Component: general (show other bugs)
Version: 4.7
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Peter Penz
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-31 01:16 UTC by Hussam Al-Tayeb
Modified: 2011-10-05 15:14 UTC (History)
7 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hussam Al-Tayeb 2011-07-31 01:16:06 UTC
Version:           1.7 (using KDE 4.7.0) 
OS:                Linux

dophin hangs when I open /usr/lib/ and I click on details view mod

I did gdb `pidof dolphin`
bt
#0  0xb6ff99e8 in QString::free () from /usr/lib/libkdecore.so.5
#1  0xb70eb4c2 in KMimeTypeRepository::parents(QString const&) () from /usr/lib/libkdecore.so.5
#2  0xb70ded82 in ?? () from /usr/lib/libkdecore.so.5
#3  0xb70def58 in KMimeType::is(QString const&) const () from /usr/lib/libkdecore.so.5
#4  0xb538010c in ?? () from /usr/lib/libkio.so.5
#5  0xb5382473 in KFileItem::overlays() const () from /usr/lib/libkio.so.5
#6  0xb537062d in KDirModel::data(QModelIndex const&, int) const () from /usr/lib/libkio.so.5
#7  0xb090403b in DolphinModel::data(QModelIndex const&, int) const () from /usr/lib/libdolphinprivate.so.4
#8  0xb699c707 in QSortFilterProxyModel::data(QModelIndex const&, int) const () from /usr/lib/libQtGui.so.4
#9  0xb53939cf in KFileItemDelegate::Private::decoration(QStyleOptionViewItemV4 const&, QModelIndex const&) const () from /usr/lib/libkio.so.5
#10 0xb5393f77 in KFileItemDelegate::Private::initStyleOption(QStyleOptionViewItemV4*, QModelIndex const&) const () from /usr/lib/libkio.so.5
#11 0xb5398009 in KFileItemDelegate::sizeHint(QStyleOptionViewItem const&, QModelIndex const&) const () from /usr/lib/libkio.so.5
#12 0xb692f64c in ?? () from /usr/lib/libQtGui.so.4
#13 0xb693abd7 in ?? () from /usr/lib/libQtGui.so.4
#14 0xb692e745 in ?? () from /usr/lib/libQtGui.so.4
#15 0xb692e8c4 in QListView::doItemsLayout() () from /usr/lib/libQtGui.so.4
#16 0xb692ec0d in QListView::rectForIndex(QModelIndex const&) const () from /usr/lib/libQtGui.so.4
#17 0xb692f1d1 in QListView::visualRect(QModelIndex const&) const () from /usr/lib/libQtGui.so.4
#18 0xb755b378 in KCategorizedView::visualRect(QModelIndex const&) const () from /usr/lib/libkdeui.so.5
#19 0xb5318c36 in KIO::DefaultViewAdapter::visualRect(QModelIndex const&) const () from /usr/lib/libkio.so.5
#20 0xb0a11779 in KFilePreviewGenerator::Private::orderItems(KFileItemList&) () from /usr/lib/libkfile.so.4
#21 0xb0a145ee in KFilePreviewGenerator::Private::updateIcons(KFileItemList const&) () from /usr/lib/libkfile.so.4
#22 0xb0a150fd in KFilePreviewGenerator::Private::updateIcons(QModelIndex const&, QModelIndex const&) () from /usr/lib/libkfile.so.4
#23 0xb0a156ad in KFilePreviewGenerator::qt_metacall(QMetaObject::Call, int, void**) () from /usr/lib/libkfile.so.4
#24 0xb6e585ad in QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib/libQtCore.so.4
#25 0xb6e6735a in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#26 0xb6eb4ddd in QAbstractItemModel::dataChanged(QModelIndex const&, QModelIndex const&) () from /usr/lib/libQtCore.so.4
#27 0xb536f780 in KDirModel::setData(QModelIndex const&, QVariant const&, int) () from /usr/lib/libkio.so.5
#28 0xb0904418 in DolphinModel::setData(QModelIndex const&, QVariant const&, int) () from /usr/lib/libdolphinprivate.so.4
#29 0xb0a14dff in KFilePreviewGenerator::setPreviewShown(bool) () from /usr/lib/libkfile.so.4
#30 0xb0918a7c in ?? () from /usr/lib/libdolphinprivate.so.4
#31 0xb08f71ed in DolphinDetailsView::DolphinDetailsView(QWidget*, DolphinViewController*, ViewModeController const*, DolphinSortFilterProxyModel*) ()
   from /usr/lib/libdolphinprivate.so.4
#32 0xb08eea0f in DolphinView::ViewAccessor::createView(QWidget*, DolphinViewController*, ViewModeController const*, DolphinView::Mode) () from /usr/lib/libdolphinprivate.so.4
#33 0xb08eeee2 in DolphinView::createView() () from /usr/lib/libdolphinprivate.so.4
#34 0xb08f341a in DolphinView::setMode(DolphinView::Mode) () from /usr/lib/libdolphinprivate.so.4
#35 0xb0909851 in DolphinViewActionHandler::slotViewModeActionTriggered(QAction*) () from /usr/lib/libdolphinprivate.so.4
#36 0xb08e4964 in DolphinViewActionHandler::qt_metacall(QMetaObject::Call, int, void**) () from /usr/lib/libdolphinprivate.so.4
#37 0xb6e585ad in QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib/libQtCore.so.4
#38 0xb6e6735a in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#39 0xb7494eb5 in KSelectAction::triggered(QAction*) () from /usr/lib/libkdeui.so.5
#40 0xb74958db in KSelectAction::actionTriggered(QAction*) () from /usr/lib/libkdeui.so.5
#41 0xb7497b06 in KSelectAction::qt_metacall(QMetaObject::Call, int, void**) () from /usr/lib/libkdeui.so.5
#42 0xb6e585ad in QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib/libQtCore.so.4
#43 0xb6e6735a in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#44 0xb637fe55 in QActionGroup::triggered(QAction*) () from /usr/lib/libQtGui.so.4
#45 0xb637fef9 in ?? () from /usr/lib/libQtGui.so.4
#46 0xb63801c3 in QActionGroup::qt_metacall(QMetaObject::Call, int, void**) () from /usr/lib/libQtGui.so.4
#47 0xb6e585ad in QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib/libQtCore.so.4
#48 0xb6e6735a in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#49 0xb637ce1d in QAction::triggered(bool) () from /usr/lib/libQtGui.so.4
#50 0xb637d0bb in QAction::activate(QAction::ActionEvent) () from /usr/lib/libQtGui.so.4
#51 0xb68661a0 in QToolButton::nextCheckState() () from /usr/lib/libQtGui.so.4
#52 0xb678f3c7 in ?? () from /usr/lib/libQtGui.so.4
#53 0xb678f6c6 in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/libQtGui.so.4
#54 0xb686623d in QToolButton::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/libQtGui.so.4
#55 0xb63ddfd8 in QWidget::event(QEvent*) () from /usr/lib/libQtGui.so.4
#56 0xb678e969 in QAbstractButton::event(QEvent*) () from /usr/lib/libQtGui.so.4
#57 0xb686796c in QToolButton::event(QEvent*) () from /usr/lib/libQtGui.so.4
#58 0xb6384084 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#59 0xb638a0f0 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#60 0xb75898b1 in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#61 0xb6e521be in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#62 0xb6385045 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib/libQtGui.so.4
#63 0xb640e677 in ?? () from /usr/lib/libQtGui.so.4
#64 0xb640d20d in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/libQtGui.so.4
#65 0xb6437aac in ?? () from /usr/lib/libQtGui.so.4
#66 0xb5b36c4f in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#67 0xb5b373b0 in ?? () from /usr/lib/libglib-2.0.so.0
#68 0xb5b376da in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
---Type <return> to continue, or q <return> to quit---
#69 0xb6e8044a in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#70 0xb64376ba in ?? () from /usr/lib/libQtGui.so.4
#71 0xb6e511fd in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#72 0xb6e51441 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#73 0xb6e55bad in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#74 0xb6381ed4 in QApplication::exec() () from /usr/lib/libQtGui.so.4
#75 0xb0ac43a3 in kdemain () from /usr/lib/libkdeinit4_dolphin.so
#76 0x0804f29a in _start ()


Reproducible: Always

Steps to Reproduce:
1. open /usr/lib
2. click on 'details view mode'

Actual Results:  
dolphin hangs forever

Expected Results:  
dolphin should not hang.
Comment 1 Hussam Al-Tayeb 2011-07-31 01:34:45 UTC
I forgot to mention that this wasn't a problem under kde 4.6.5
Comment 2 Peter Penz 2011-07-31 07:48:45 UTC
Thanks for the report, I could reproduce this regression. Seems to be related to the changed overlay code in KFileItem. Adding David Faure to CC...
Comment 3 Christoph Feck 2011-07-31 13:06:11 UTC
Probably caused by commit 034324e0.
Comment 4 Christoph Feck 2011-07-31 13:24:50 UTC
More probably caused by commit df13ea27.
Comment 5 Dawit Alemayehu 2011-08-01 05:31:14 UTC
(In reply to comment #4)
> More probably caused by commit df13ea27.

Nope. If you back that commit out, you still see the problem.
Comment 6 Frits Spieker 2011-08-01 11:13:55 UTC
I tried it out as well and at first Dolphin indeed seemed to hang; became unresponsive. However, after waiting for about 30 seconds, it did show the directory /usr/lib in detail mode.

(KDE4.7.0, Opensuse 11.4 64b)
Comment 7 Frits Spieker 2011-08-01 11:16:45 UTC
P.S. Switching back to icon mode is instantaneous, after which switching to detailed mode again causes the appr. 30 second hang.
Comment 8 Hussam Al-Tayeb 2011-08-02 21:45:22 UTC
I found a way to avoid the crash.
Instead of clicking on "Details view mode", click on "Columns view mode" and then click on "Details view mode". Dolphin will no hang.
Comment 9 Hussam Al-Tayeb 2011-10-03 23:33:04 UTC
Any progress on this one? :)
Comment 10 David Faure 2011-10-04 09:49:11 UTC
OK I could reproduce the bug with dolphin-4.7 and /usr/lib64 (opensuse).

(in dolphin-master this bug doesn't seem to happen, but on the other hand when enabling previews in details+tree mode, the icons become right-aligned, looks quite weird)

It looks like this comes from QIconModeViewBase::doBatchedItemLayout being called many times (from the preview generator), and calculating the DecorationRole every time (due to "non uniform item sizes", didn't we use to set that?). Over all this looks much more like a bug for Peter to look into :-)

OK DecorationRole now calls overlays(), but... it shouldn't be called so many times in the first place, and overlays doesn't seem to take that much time itself...

More precise data from callgrind/kcachegrind:
* 60% of the time is spent in KFileItemDelegate::Private::displaySizeHint() calling layoutText(), calling QTextLine. So it's all in text layouting. These methods are called 152000 times (!).
Above in the stack, QListViewPrivate::doItemsLayout is called 57 times, from KFilePreviewGenerator::Private::orderItems which is called 2776 times. The items layout isn't dirty every time, this is why only 57 times out of the 2776, it goes and re-does the items layout.
The real question is what makes the items layout dirty, and this I can't see in callgrind.
Unless it's QAbstractItemView::scheduledDelayedItemsLayout, called by DolphinIconsView::dataChanged.

Peter, does any of this ring any bells, from the time you were looking into all this?
Comment 11 Peter Penz 2011-10-04 10:01:08 UTC
Thanks David for the good analyses. Strange: Uniform row-sizes should be set, I'll check during the next days whether it might be a result of changes in DolphinDetailsView...

Regarding:
> (in dolphin-master this bug doesn't seem to happen, but on
> the other hand when enabling previews in details+tree mode,
> the icons become right-aligned, looks quite weird)

Will fix that during the next days (looks really weird), I just did some changes during the last week in this area which resulted into this issue.
Comment 12 Peter Penz 2011-10-04 12:09:19 UTC
Git commit dce0f346c7f6aa741d42372a774c357dfc550b15 by Peter Penz.
Committed on 04/10/2011 at 14:00.
Pushed by ppenz into branch 'KDE/4.7'.

Fix performance regression in KFilePreviewGenerator

When switching from the details-view to the icons-view in Dolphin/
Konqueror a freeze might occur for several seconds. The root cause
for this is commit 41854146040f8638fffb13b20a75f6ecda2837a6. Using
the DateChangeObtainer only worked for the icons-view but in case
of the details-view still inside Qt a layout change got triggered.
As we know that in our case changing the icon won't result in a
change of the layout the signals of the directory-model will get
blocked temporary. By using the new view-engine such ugly workarounds
won't be needed anymore but KFilePreviewGenerator is still used
by other applications.

Thanks to David Faure for investigating into the root-cause!

BUG: 278899
FIXED-IN: 4.7.3

M  +5    -1    kfile/kfilepreviewgenerator.cpp

http://commits.kde.org/kdelibs/dce0f346c7f6aa741d42372a774c357dfc550b15
Comment 13 Hussam Al-Tayeb 2011-10-04 12:45:05 UTC
Thank you very much for fixing this bug :)
Comment 14 David Faure 2011-10-04 14:47:55 UTC
Git commit 116cb70f05ef1a6622b707aa9822943073bb7a24 by David Faure, on behalf of Peter Penz.
Committed on 04/10/2011 at 14:00.
Pushed by dfaure into branch 'frameworks'.

Fix performance regression in KFilePreviewGenerator

When switching from the details-view to the icons-view in Dolphin/
Konqueror a freeze might occur for several seconds. The root cause
for this is commit 41854146040f8638fffb13b20a75f6ecda2837a6. Using
the DateChangeObtainer only worked for the icons-view but in case
of the details-view still inside Qt a layout change got triggered.
As we know that in our case changing the icon won't result in a
change of the layout the signals of the directory-model will get
blocked temporary. By using the new view-engine such ugly workarounds
won't be needed anymore but KFilePreviewGenerator is still used
by other applications.

Thanks to David Faure for investigating into the root-cause!

BUG: 278899
FIXED-IN: 4.7.3

M  +5    -1    kfile/kfilepreviewgenerator.cpp

http://commits.kde.org/kdelibs/116cb70f05ef1a6622b707aa9822943073bb7a24
Comment 15 Peter Penz 2011-10-05 15:14:46 UTC
Git commit 2546deeb1ec4373f35d70ea3cf7b6a31e0196acf by Peter Penz.
Committed on 05/10/2011 at 17:12.
Pushed by ppenz into branch 'master'.

Don't apply an empty item-size to the layout

This fixes strange layout-issues when turning on/off previews in the
details-view.

CCBUG: 278899

M  +6    -6    dolphin/src/kitemviews/kitemlistview.cpp

http://commits.kde.org/kde-baseapps/2546deeb1ec4373f35d70ea3cf7b6a31e0196acf