[Korganizer-devel] [Bug 170993] New: Switching calendar views takes more than 20 seconds eating 100% CPU

Eduardo Habkost ehabkost at raisama.net
Sat Sep 13 18:34:23 CEST 2008


http://bugs.kde.org/show_bug.cgi?id=170993

           Summary: Switching calendar views takes more than 20 seconds
                    eating 100% CPU
           Product: korganizer
           Version: unspecified
          Platform: Compiled Sources
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: NOR
         Component: general
        AssignedTo: korganizer-devel at kde.org
        ReportedBy: ehabkost at raisama.net


Version:           SVN trunk, revision 860448 (using Devel)
OS:                Linux
Installed from:    Compiled sources

When using my calendar, KOrganizer takes more than 20 seconds to respond when I
click on any of the calendar view buttons (day, week, month, etc). This happens
even if I click on the button corresponding to the view I am currently looking
at.

Debugging has shown it is taking lots of time inside
KOTodoModel::reloadTodos(), at the emit dataChanged loop. When using my
calendar data, each reloadTodos() call emits 1539 signals, taking up to 17
seconds (sometimes even more: I have seen it taking 40 seconds) to run the
loop.

Profiling and randomly interrupting KOrganizer during the busy loop has shown
it is spending most of time inside this call trace:

(gdb) bt full
#0  0x00ab7231 in QCoreApplicationPrivate::removePostedEvents_unlocked
(receiver=<value optimized out>, eventType=<value optimized out>, data=<value
optimized out>)
    at kernel/qcoreapplication.cpp:1302
        i = <value optimized out>
        n = 2780
        j = 2103
#1  0x00ace612 in ~QObject (this=<value optimized out>) at
kernel/qobject.cpp:877
No locals.
#2  0x070ec408 in ~QTextDocument (this=Could not find the frame base for
"~QTextDocument".
) at text/qtextdocument.cpp:344
No locals.
#3  0x010aaa49 in KOTodoRichTextDelegate::sizeHint (this=0x9dd06a0,
option=@0xbfc1ca84, index=@0xbfc1cb04)
    at
/mnt/common/code/kde/svn/trunk/KDE/kdepim/korganizer/views/todoview/kotododelegates.cpp:469
        tmp = {<QObject> = {_vptr.QObject = 0xb9c9a8, static staticMetaObject =
{d = {superdata = 0x0, stringdata = 0xb46880 "QObject", data = 0xb46900,
        extradata = 0x0}}, d_ptr = 0xa4c3568, static staticQtMetaObject = {d =
{superdata = 0x0, stringdata = 0xb4f960 "Qt", data = 0xb51600, extradata =
0x0}}},
  static staticMetaObject = {d = {superdata = 0xb99458, stringdata = 0x75109e0
"QTextDocument", data = 0x7510c00, extradata = 0x0}}}
        ret = {wd = 4, ht = 23}
        ret = {wd = 162133928, ht = -1077818872}
#4  0x073cf8e9 in QTreeView::indexRowSizeHint (this=<value optimized out>,
index=<value optimized out>) at itemviews/qtreeview.cpp:2720
        editor = <value optimized out>
        logicalColumn = <value optimized out>
        idx = Could not find the frame base for
"QTreeView::indexRowSizeHint(QModelIndex const&) const".
(gdb) bt
#0  0x00ab7231 in QCoreApplicationPrivate::removePostedEvents_unlocked
(receiver=<value optimized out>, eventType=<value optimized out>, data=<value
optimized out>)
    at kernel/qcoreapplication.cpp:1302
#1  0x00ace612 in ~QObject (this=<value optimized out>) at
kernel/qobject.cpp:877
#2  0x070ec408 in ~QTextDocument (this=Could not find the frame base for
"~QTextDocument".
) at text/qtextdocument.cpp:344
#3  0x010aaa49 in KOTodoRichTextDelegate::sizeHint (this=0x9dd06a0,
option=@0xbfc1ca84, index=@0xbfc1cb04)
    at
/mnt/common/code/kde/svn/trunk/KDE/kdepim/korganizer/views/todoview/kotododelegates.cpp:469
#4  0x073cf8e9 in QTreeView::indexRowSizeHint (this=<value optimized out>,
index=<value optimized out>) at itemviews/qtreeview.cpp:2720
#5  0x073cfc62 in QTreeViewPrivate::itemHeight (this=<value optimized out>,
item=<value optimized out>) at itemviews/qtreeview.cpp:3100
#6  0x073cff2e in QTreeViewPrivate::updateScrollBars (this=<value optimized
out>) at itemviews/qtreeview.cpp:3405
#7  0x073d02b2 in QTreeView::updateGeometries (this=<value optimized out>) at
itemviews/qtreeview.cpp:2616
#8  0x0738e989 in QAbstractItemView::doItemsLayout (this=Could not find the
frame base for "QAbstractItemView::doItemsLayout()".
) at itemviews/qabstractitemview.cpp:1002
#9  0x073db832 in QTreeView::doItemsLayout (this=<value optimized out>) at
itemviews/qtreeview.cpp:1949
#10 0x073cb4df in QTreeView::resizeColumnToContents (this=<value optimized
out>, column=<value optimized out>) at
../../src/gui/itemviews/qabstractitemview_p.h:179
#11 0x073cb5ce in QTreeViewPrivate::_q_forceColumnResizeToFitContents
(this=<value optimized out>) at itemviews/qtreeview.cpp:2982
#12 0x073db29c in QTreeView::qt_metacall (this=<value optimized out>, _c=<value
optimized out>, _id=<value optimized out>, _a=<value optimized out>)
    at .moc/release-shared/moc_qtreeview.cpp:149
#13 0x010ae5f6 in KOTodoViewView::qt_metacall (this=0x9db2590,
_c=QMetaObject::InvokeMetaMethod, _id=91, _a=0xbfc1ce08)
    at
/mnt/common/code/kde/build/trunk/KDE/kdepim/korganizer/kotodoviewview.moc:61
#14 0x00acc3e0 in QMetaObject::activate (sender=<value optimized out>,
from_signal_index=<value optimized out>, to_signal_index=<value optimized out>,
    argv=<value optimized out>) at kernel/qobject.cpp:3016
#15 0x00acd162 in QMetaObject::activate (sender=<value optimized out>, m=<value
optimized out>, local_signal_index=<value optimized out>, argv=Could not find
the frame base for "QMetaObject::activate(QObject*, QMetaObject const*, int,
void**)".
)
    at kernel/qobject.cpp:3086
#16 0x00b065b7 in QAbstractItemModel::layoutChanged (this=Could not find the
frame base for "QAbstractItemModel::layoutChanged()".
) at .moc/release-shared/moc_qabstractitemmodel.cpp:137
#17 0x0741f282 in QSortFilterProxyModelPrivate::_q_sourceDataChanged
(this=<value optimized out>, source_top_left=<value optimized out>,
    source_bottom_right=<value optimized out>) at
itemviews/qsortfilterproxymodel.cpp:1011
#18 0x0741fd5f in QSortFilterProxyModel::qt_metacall (this=<value optimized
out>, _c=<value optimized out>, _id=<value optimized out>, _a=<value optimized
out>)
    at .moc/release-shared/moc_qsortfilterproxymodel.cpp:119
#19 0x010ad268 in KOTodoViewSortFilterProxyModel::qt_metacall (this=0x9dba190,
_c=QMetaObject::InvokeMetaMethod, _id=26, _a=0xbfc1d038)
    at
/mnt/common/code/kde/build/trunk/KDE/kdepim/korganizer/kotodoviewsortfilterproxymodel.moc:61
#20 0x00acc3e0 in QMetaObject::activate (sender=<value optimized out>,
from_signal_index=<value optimized out>, to_signal_index=<value optimized out>,
    argv=<value optimized out>) at kernel/qobject.cpp:3016
#21 0x00acd162 in QMetaObject::activate (sender=<value optimized out>, m=<value
optimized out>, local_signal_index=<value optimized out>, argv=Could not find
the frame base for "QMetaObject::activate(QObject*, QMetaObject const*, int,
void**)".
)
    at kernel/qobject.cpp:3086
#22 0x00b06669 in QAbstractItemModel::dataChanged (this=Could not find the
frame base for "QAbstractItemModel::dataChanged(QModelIndex const&, QModelIndex
const&)".
) at .moc/release-shared/moc_qabstractitemmodel.cpp:124
#23 0x010a7c37 in KOTodoModel::reloadTodos (this=0x9d91228) at
/mnt/common/code/kde/svn/trunk/KDE/kdepim/korganizer/views/todoview/kotodomodel.cpp:258
#24 0x010b11fe in KOTodoView::updateView (this=0x9dc6f68) at
/mnt/common/code/kde/svn/trunk/KDE/kdepim/korganizer/views/todoview/kotodoview.cpp:346


It looks like multiple problems are being multiplied:

- Changing the calendar view trigger reloadTodos() multiple times (two or more,
on my tests), even if I am not seeing the TODO-list treeview on the screen
- reloadTodos() trigger many dataChanged() signals
- Each dataChanged() signal trigges style recalculation on the todo tree view
- Each style recalculation trigger multiple size hint recalculations, for each
todo item
- Each size hint recalculation for a tree view row creates a short-lived
QTextDocument object, that will trigger an expensive loop at
QCoreApplicationPrivate::removePostedEvents_unlocked() when destroyed


-- 
Configure bugmail: http://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Korganizer-devel mailing list