Bug 393059

Summary: KOrganizer crashes when using caldav calendar
Product: [Applications] korganizer Reporter: bugzy <bugzylittle>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: crash CC: kdenis, onkekabonke, wbauer1, winter
Priority: NOR Keywords: drkonqi
Version: 5.7.3   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In: 5.8.0
Attachments: Todo Calendar fentry that crashes korganizer
terminal output on delete of bad entry

Description bugzy 2018-04-12 18:51:56 UTC
Application: korganizer (5.7.3)

Qt Version: 5.9.4
Frameworks Version: 5.44.0
Operating System: Linux 4.15.13-300.fc27.x86_64 x86_64
Distribution: "Fedora release 27 (Twenty Seven)"

-- Information about the crash:
- What I was doing when the application crashed:
I opened KOrganizer and it crashed.

I am unsure if this issue is related to a calendar entry of some sort; I have been trying to disable soem of my calendars in to see if I can narrow it down but I have had no success thus far. I will update this if I find the culprit.

The crash can be reproduced every time.

-- Backtrace:
Application: KOrganizer (korganizer), signal: Segmentation fault
Using host libthread_db library "/lib64/libthread_db.so.1".
[Current thread is 1 (Thread 0x7ff0ca722940 (LWP 24550))]

Thread 5 (Thread 0x7ff09a5ed700 (LWP 24555)):
#0  0x00007ff0c1071738 in read () from /lib64/libc.so.6
#1  0x00007ff0b65c40a0 in g_wakeup_acknowledge () from /lib64/libglib-2.0.so.0
#2  0x00007ff0b657f9a8 in g_main_context_check () from /lib64/libglib-2.0.so.0
#3  0x00007ff0b657fe40 in g_main_context_iterate.isra () from /lib64/libglib-2.0.so.0
#4  0x00007ff0b657ffac in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#5  0x00007ff0c1ecbc4b in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#6  0x00007ff0c1e7996a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#7  0x00007ff0c1cca8ca in QThread::exec() () from /lib64/libQt5Core.so.5
#8  0x00007ff0c1ccede2 in QThreadPrivate::start(void*) () from /lib64/libQt5Core.so.5
#9  0x00007ff0bb6f750b in start_thread () from /lib64/libpthread.so.0
#10 0x00007ff0c108016f in clone () from /lib64/libc.so.6

Thread 4 (Thread 0x7ff09adee700 (LWP 24553)):
#0  0x00007ff0c1071738 in read () from /lib64/libc.so.6
#1  0x00007ff0b65c40a0 in g_wakeup_acknowledge () from /lib64/libglib-2.0.so.0
#2  0x00007ff0b657f9a8 in g_main_context_check () from /lib64/libglib-2.0.so.0
#3  0x00007ff0b657fe40 in g_main_context_iterate.isra () from /lib64/libglib-2.0.so.0
#4  0x00007ff0b657ffac in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#5  0x00007ff0c1ecbc4b in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#6  0x00007ff0c1e7996a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#7  0x00007ff0c1cca8ca in QThread::exec() () from /lib64/libQt5Core.so.5
#8  0x00007ff0c1ccede2 in QThreadPrivate::start(void*) () from /lib64/libQt5Core.so.5
#9  0x00007ff0bb6f750b in start_thread () from /lib64/libpthread.so.0
#10 0x00007ff0c108016f in clone () from /lib64/libc.so.6

Thread 3 (Thread 0x7ff09bfff700 (LWP 24552)):
#0  0x00007ff0c1071738 in read () from /lib64/libc.so.6
#1  0x00007ff0b65c40a0 in g_wakeup_acknowledge () from /lib64/libglib-2.0.so.0
#2  0x00007ff0b657f9a8 in g_main_context_check () from /lib64/libglib-2.0.so.0
#3  0x00007ff0b657fe40 in g_main_context_iterate.isra () from /lib64/libglib-2.0.so.0
#4  0x00007ff0b657ffac in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#5  0x00007ff0c1ecbc4b in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#6  0x00007ff0c1e7996a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#7  0x00007ff0c1cca8ca in QThread::exec() () from /lib64/libQt5Core.so.5
#8  0x00007ff0c36d2449 in QDBusConnectionManager::run() () from /lib64/libQt5DBus.so.5
#9  0x00007ff0c1ccede2 in QThreadPrivate::start(void*) () from /lib64/libQt5Core.so.5
#10 0x00007ff0bb6f750b in start_thread () from /lib64/libpthread.so.0
#11 0x00007ff0c108016f in clone () from /lib64/libc.so.6

Thread 2 (Thread 0x7ff0a34d8700 (LWP 24551)):
#0  0x00007ff0c1075c6b in poll () from /lib64/libc.so.6
#1  0x00007ff0b9cc6fe7 in _xcb_conn_wait () from /lib64/libxcb.so.1
#2  0x00007ff0b9cc8dda in xcb_wait_for_event () from /lib64/libxcb.so.1
#3  0x00007ff0a563abf9 in QXcbEventReader::run() () from /lib64/libQt5XcbQpa.so.5
#4  0x00007ff0c1ccede2 in QThreadPrivate::start(void*) () from /lib64/libQt5Core.so.5
#5  0x00007ff0bb6f750b in start_thread () from /lib64/libpthread.so.0
#6  0x00007ff0c108016f in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7ff0ca722940 (LWP 24550)):
[KCrash Handler]
#6  0x00007ff0c92bad50 in greaterThan(QSharedPointer<PreNode> const&, QSharedPointer<PreNode> const&) () from /lib64/libKF5EventViews.so.5
#7  0x00007ff0c92c329a in void std::__unguarded_linear_insert<QList<QSharedPointer<PreNode> >::iterator, __gnu_cxx::__ops::_Val_comp_iter<bool (*)(QSharedPointer<PreNode> const&, QSharedPointer<PreNode> const&)> >(QList<QSharedPointer<PreNode> >::iterator, __gnu_cxx::__ops::_Val_comp_iter<bool (*)(QSharedPointer<PreNode> const&, QSharedPointer<PreNode> const&)>) () from /lib64/libKF5EventViews.so.5
#8  0x00007ff0c92bfc3b in IncidenceTreeModel::Private::onRowsInserted(QModelIndex const&, int, int) () from /lib64/libKF5EventViews.so.5
#9  0x00007ff0c1ea3513 in QMetaObject::activate(QObject*, int, int, void**) () from /lib64/libQt5Core.so.5
#10 0x00007ff0c1e23d8e in QAbstractItemModel::rowsInserted(QModelIndex const&, int, int, QAbstractItemModel::QPrivateSignal) () from /lib64/libQt5Core.so.5
#11 0x00007ff0c1e2ac8b in QAbstractItemModel::endInsertRows() () from /lib64/libQt5Core.so.5
#12 0x00007ff0c1e45fb5 in QSortFilterProxyModelPrivate::insert_source_items(QVector<int>&, QVector<int>&, QVector<int> const&, QModelIndex const&, Qt::Orientation, bool) () from /lib64/libQt5Core.so.5
#13 0x00007ff0c1e494ce in QSortFilterProxyModelPrivate::source_items_inserted(QModelIndex const&, int, int, Qt::Orientation) () from /lib64/libQt5Core.so.5
#14 0x00007ff0c1e497af in QSortFilterProxyModelPrivate::_q_sourceRowsInserted(QModelIndex const&, int, int) () from /lib64/libQt5Core.so.5
#15 0x00007ff0c1e4c429 in QSortFilterProxyModel::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) () from /lib64/libQt5Core.so.5
#16 0x00007ff0c1ea3513 in QMetaObject::activate(QObject*, int, int, void**) () from /lib64/libQt5Core.so.5
#17 0x00007ff0c1e23d8e in QAbstractItemModel::rowsInserted(QModelIndex const&, int, int, QAbstractItemModel::QPrivateSignal) () from /lib64/libQt5Core.so.5
#18 0x00007ff0c1e2ac8b in QAbstractItemModel::endInsertRows() () from /lib64/libQt5Core.so.5
#19 0x00007ff0c1e45fb5 in QSortFilterProxyModelPrivate::insert_source_items(QVector<int>&, QVector<int>&, QVector<int> const&, QModelIndex const&, Qt::Orientation, bool) () from /lib64/libQt5Core.so.5
#20 0x00007ff0c1e494ce in QSortFilterProxyModelPrivate::source_items_inserted(QModelIndex const&, int, int, Qt::Orientation) () from /lib64/libQt5Core.so.5
#21 0x00007ff0c1e497af in QSortFilterProxyModelPrivate::_q_sourceRowsInserted(QModelIndex const&, int, int) () from /lib64/libQt5Core.so.5
#22 0x00007ff0c1e4c429 in QSortFilterProxyModel::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) () from /lib64/libQt5Core.so.5
#23 0x00007ff0c1ea3513 in QMetaObject::activate(QObject*, int, int, void**) () from /lib64/libQt5Core.so.5
#24 0x00007ff0c1e23d8e in QAbstractItemModel::rowsInserted(QModelIndex const&, int, int, QAbstractItemModel::QPrivateSignal) () from /lib64/libQt5Core.so.5
#25 0x00007ff0c1e2ac8b in QAbstractItemModel::endInsertRows() () from /lib64/libQt5Core.so.5
#26 0x00007ff0c1e45fb5 in QSortFilterProxyModelPrivate::insert_source_items(QVector<int>&, QVector<int>&, QVector<int> const&, QModelIndex const&, Qt::Orientation, bool) () from /lib64/libQt5Core.so.5
#27 0x00007ff0c1e494ce in QSortFilterProxyModelPrivate::source_items_inserted(QModelIndex const&, int, int, Qt::Orientation) () from /lib64/libQt5Core.so.5
#28 0x00007ff0c1e497af in QSortFilterProxyModelPrivate::_q_sourceRowsInserted(QModelIndex const&, int, int) () from /lib64/libQt5Core.so.5
#29 0x00007ff0c1e4c429 in QSortFilterProxyModel::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) () from /lib64/libQt5Core.so.5
#30 0x00007ff0c1ea3513 in QMetaObject::activate(QObject*, int, int, void**) () from /lib64/libQt5Core.so.5
#31 0x00007ff0c1e23d8e in QAbstractItemModel::rowsInserted(QModelIndex const&, int, int, QAbstractItemModel::QPrivateSignal) () from /lib64/libQt5Core.so.5
#32 0x00007ff0c1e2ac8b in QAbstractItemModel::endInsertRows() () from /lib64/libQt5Core.so.5
#33 0x00007ff0c6a17c9e in KSelectionProxyModelPrivate::sourceRowsInserted(QModelIndex const&, int, int) () from /lib64/libKF5ItemModels.so.5
#34 0x00007ff0c1ea3513 in QMetaObject::activate(QObject*, int, int, void**) () from /lib64/libQt5Core.so.5
#35 0x00007ff0c1e23d8e in QAbstractItemModel::rowsInserted(QModelIndex const&, int, int, QAbstractItemModel::QPrivateSignal) () from /lib64/libQt5Core.so.5
#36 0x00007ff0c1e2ac8b in QAbstractItemModel::endInsertRows() () from /lib64/libQt5Core.so.5
#37 0x00007ff0c6db5d68 in Akonadi::EntityTreeModelPrivate::itemsFetched(long long, QVector<Akonadi::Item> const&) () from /lib64/libKF5AkonadiCore.so.5
#38 0x00007ff0c6db5fce in Akonadi::EntityTreeModelPrivate::itemsFetched(QVector<Akonadi::Item> const&) () from /lib64/libKF5AkonadiCore.so.5
#39 0x00007ff0c6da7835 in Akonadi::EntityTreeModel::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) () from /lib64/libKF5AkonadiCore.so.5
#40 0x00007ff0c1ea3513 in QMetaObject::activate(QObject*, int, int, void**) () from /lib64/libQt5Core.so.5
#41 0x00007ff0c6d68332 in Akonadi::ItemFetchJob::itemsReceived(QVector<Akonadi::Item> const&) () from /lib64/libKF5AkonadiCore.so.5
#42 0x00007ff0c6d6a69b in Akonadi::ItemFetchJobPrivate::aboutToFinish() () from /lib64/libKF5AkonadiCore.so.5
#43 0x00007ff0c6d72e85 in Akonadi::JobPrivate::delayedEmitResult() () from /lib64/libKF5AkonadiCore.so.5
#44 0x00007ff0c1eaf934 in QSingleShotTimer::timerEvent(QTimerEvent*) () from /lib64/libQt5Core.so.5
#45 0x00007ff0c1ea421b in QObject::event(QEvent*) () from /lib64/libQt5Core.so.5
#46 0x00007ff0c2d7b92c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib64/libQt5Widgets.so.5
#47 0x00007ff0c2d83174 in QApplication::notify(QObject*, QEvent*) () from /lib64/libQt5Widgets.so.5
#48 0x00007ff0c1e7abe7 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib64/libQt5Core.so.5
#49 0x00007ff0c1ecaf5b in QTimerInfoList::activateTimers() () from /lib64/libQt5Core.so.5
#50 0x00007ff0c1ecb7f1 in timerSourceDispatch(_GSource*, int (*)(void*), void*) () from /lib64/libQt5Core.so.5
#51 0x00007ff0b657fb77 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#52 0x00007ff0b657ff20 in g_main_context_iterate.isra () from /lib64/libglib-2.0.so.0
#53 0x00007ff0b657ffac in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#54 0x00007ff0c1ecbc2f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#55 0x00007ff0c1e7996a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#56 0x00007ff0c1e82094 in QCoreApplication::exec() () from /lib64/libQt5Core.so.5
#57 0x000055dbb83a40dc in main ()

Reported using DrKonqi
Comment 1 bugzy 2018-04-13 03:53:48 UTC
Created attachment 111994 [details]
Todo Calendar fentry that crashes korganizer

After finding a way to disable my calendar collections and re-enable each calendar one by one, I was able to narrow down the cause of the crash to the attached vtodo entry. I copied the contents of the entry using akonadiconsole and pasted it in the attached file.
Comment 2 bugzy 2018-04-13 03:57:17 UTC
Created attachment 111995 [details]
terminal output on delete of bad entry

After deleting the entry directly from akonadiconsole, the line in the attached file appeared in the terminal. Not sure if it will be helpful in diagnosing the issue.
Comment 3 bugzy 2018-04-13 04:21:34 UTC
The last point to note is that I am able to reproduce the crash whenever I re-import the attached todo entry. 

Steps to reproduce:
1. Download Attached Todo calendar entry
2. Import the entry and "merge" to existing calendar.
3. Close korganizer (or kontact).
4. Open korganizer.

Expected Results:
korganizer opens properly

Actual results:
korganizer crashes
Comment 4 bugzy 2018-04-13 04:22:45 UTC
Deleting the bad entry fixes the issue but just wanted to document this behavior here.

Thanks
Comment 5 Allen Winter 2018-04-28 15:45:22 UTC
Works fine for me with KOrganizer master and libical 3.0.x

which libical version are you using?
Comment 6 bugzy 2018-04-28 15:56:56 UTC
I have libical 2.0, specifically libical-2.0.0-13.fc27.x86_64
Comment 7 Allen Winter 2018-04-28 16:48:15 UTC
does the crash only happen in month view?
i.e. can you also test agenda or todo views?
Comment 8 bugzy 2018-04-28 19:31:13 UTC
None of the other views work. The only solution to get things functional again is to disable the calendar with the problem.

Additional Information:
- All my calendars are webdav calendars synced using nextcloud to my various devices.

- I should mention that the faulty todo entry was created using Zanshin. I did not think that was relevant until I added some new todo items yesterday and began experiencing the same problem.

I use Zanshin at work and Kontact with Korganizer on laptop and home PC.
Comment 9 bugzy 2018-05-17 06:34:48 UTC
I was able to find and fix the actual cause of the problem by running the "calendarjanitor" tool. The tool found an orphaned TODO entry in the affected calendar. It turns out that whenever I added a new entry into the affected calendar, the orphaned TODO would cause korganizer to crash when parsing that calendar. So my new entries (attached above) were not the problem, I was simply adding new entries to a faulty calendar:

==Output of calendarjanitor (default scan mode):==

Checking for orphans...                                                     [!!]
    The following incidences are children of nonexistent parents:

    * Found buggy incidence:
        id=159344; summary="Set in plant dividers for garden in plot behind house"
        DTSTART=invalid; 
        DTDUE=invalid; 

    In fix mode these children will be unparented.


Running the too in fix mode solved the problem and everything has been running smooth since then.


==Output of calendarjanitor --fix (fix mode):== 
Checking for orphans...                                                     [!!]
    The following incidences are children of nonexistent parents:

    * Found buggy incidence:
        id=159344; summary="Set in plant dividers for garden in plot behind house"
        DTSTART=invalid; 
        DTDUE=invalid; 

    Children were successfully unparented.
Comment 10 Wolfgang Bauer 2018-05-17 13:22:29 UTC
The crash is probably fixed by https://cgit.kde.org/eventviews.git/commit/?h=Applications/17.12&id=a3a66bb10020e6fbdd354b4ecc6c0fee6741c467 I think.
Comment 11 Denis Kurz 2018-10-13 14:00:33 UTC
*** Bug 397314 has been marked as a duplicate of this bug. ***
Comment 12 Denis Kurz 2018-10-13 14:03:28 UTC
I think Wolfgang is right about this. According to https://phabricator.kde.org/source/eventviews/tags/master/;a3a66bb10020e6fbdd354b4ecc6c0fee6741c467 it is fixed in 18.04.0, which should be... 5.8.0, I guess? I still hate this superfluous pim extra versioning scheme...
Comment 13 Wolfgang Bauer 2018-10-13 17:01:45 UTC
(In reply to Denis Kurz from comment #12)
> it is fixed in 18.04.0, which
> should be... 5.8.0, I guess?

Yes, that's indeed 5.8.0.

Actually the fix was pushed to the 17.12 branch as well, but that was after 17.12.3/5.7.3 so it didn't make it into any 17.12 (or 5.7.x) release.