Bug 391718 - ASSERT: "it != ptrToInternal.constEnd()" in file trojita/src/Imap/Model/ThreadingMsgListModel.cpp, line 1488
Summary: ASSERT: "it != ptrToInternal.constEnd()" in file trojita/src/Imap/Model/Threa...
Status: RESOLVED WORKSFORME
Alias: None
Product: trojita
Classification: Applications
Component: Other (show other bugs)
Version: git
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Trojita default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-11 16:42 UTC by Pali Rohár
Modified: 2023-04-10 03:45 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
trojita-connection-log (204.29 KB, text/plain)
2018-03-25 21:11 UTC, Pali Rohár
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pali Rohár 2018-03-11 16:42:59 UTC
For unknown reasons trojita hangs in infinite loop on following place:

file trojita/src/Imap/Model/ThreadingMsgListModel.cpp
function ThreadingMsgListModel::handleDataChanged

134    while (rootCandidate.parent().isValid()) {
135        rootCandidate = rootCandidate.parent();
136    }

Adding breakpoint on line 137 proved it, while loop is never finished. GUI is completely freezed.

What I did? Absolutely nothing, just had opened INBOX and waiting for a new emails.

Here is gdb backtrace.

(gdb) bt
#0  0x0000555555738820 in QModelIndex::parent (this=0x7fffffffcc60) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qabstractitemmodel.h:417
#1  Imap::Mailbox::ThreadingMsgListModel::handleDataChanged (this=0x555555dbb410, topLeft=..., bottomRight=...) at trojita/src/Imap/Model/ThreadingMsgListModel.cpp:134
#2  0x00007ffff35e595e in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#3  0x00007ffff365c61c in QAbstractItemModel::dataChanged(QModelIndex const&, QModelIndex const&, QVector<int> const&) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x0000555555718ccf in Imap::Mailbox::MsgListModel::handleDataChanged (this=0x555555db6a70, topLeft=..., bottomRight=...) at trojita/src/Imap/Model/MsgListModel.cpp:105
#5  0x00007ffff35e595e in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007ffff365c61c in QAbstractItemModel::dataChanged(QModelIndex const&, QModelIndex const&, QVector<int> const&) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#7  0x00007ffff365d759 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#8  0x00007ffff35e6499 in QObject::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#9  0x00007ffff3e9cb8c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#10 0x00007ffff3ea4341 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#11 0x00007ffff35b99e0 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#12 0x00007ffff35bc16d in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#13 0x00007ffff360dc43 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#14 0x00007ffff0b3d7f7 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#15 0x00007ffff0b3da60 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#16 0x00007ffff0b3db0c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#17 0x00007ffff360e04f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#18 0x00007ffff35b79ca in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#19 0x00007ffff35c013c in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#20 0x00005555555c5ce5 in main (argc=<optimized out>, argv=<optimized out>) at trojita/src/Gui/main.cpp:218

Apparently I cannot debug it as gdb cannot resolve inlined function :-(

(gdb) up
#1  Imap::Mailbox::ThreadingMsgListModel::handleDataChanged (this=0x555555dbb410, topLeft=..., bottomRight=...) at trojita/src/Imap/Model/ThreadingMsgListModel.cpp:134
134         while (rootCandidate.parent().isValid()) {
(gdb) print rootCandidate
$1 = {r = 0, c = 0, i = 6899, m = 0x555555dbb410}
(gdb) print rootCandidate.parent
Cannot take address of method parent.
(gdb) print rootCandidate.parent()
Cannot evaluate function -- may be inlined
(gdb) print rootCandidate.parent().isValid()
Cannot evaluate function -- may be inlined
(gdb) print translated
$2 = {r = 2, c = 0, i = 6900, m = 0x555555dbb410}
Comment 1 Jan Kundrát 2018-03-11 23:12:09 UTC
If this is indeed an infinite loop, there's at least one cycle in the `threading` map. It would be nice to have access to the raw IMAP log. Without that log, I cannot really do anything.
Comment 2 Pali Rohár 2018-03-25 21:11:41 UTC
Created attachment 111653 [details]
trojita-connection-log

Now Trojita hangs in infinite loop every time I open mbox. In attachment is log file (some mbox names were anonymized to YYYY). Plus here is backtrace:

(gdb) bt
#0  Imap::Mailbox::TreeItemMessage::uid (this=0x564a08c1a080) at trojita/src/Imap/Model/MailboxTree.cpp:1436
#1  0x0000564a05c24571 in (anonymous namespace)::messageHasUidZero (item=<optimized out>) at trojita/src/Imap/Model/Model.cpp:96
#2  Common::linearLowerBoundWithUnknownElements<QTypedArrayData<Imap::Mailbox::TreeItem*>::iterator, unsigned int, bool (*)(Imap::Mailbox::TreeItem const*), bool (*)(Imap::Mailbox::TreeItem const*, unsigned int)> (lessThan=0x564a05c218e0 <(anonymous namespace)::uidComparator(Imap::Mailbox::TreeItem const*, uint)>, isUnknown=<optimized out>, value=<synthetic pointer>: <optimized out>, end=..., begin=...) at trojita/src/Common/FindWithUnknown.h:38
#3  Common::lowerBoundWithUnknownElements<QTypedArrayData<Imap::Mailbox::TreeItem*>::iterator, unsigned int, bool (*)(Imap::Mailbox::TreeItem const*), bool (*)(Imap::Mailbox::TreeItem const*, unsigned int)> (lessThan=0x564a05c218e0 <(anonymous namespace)::uidComparator(Imap::Mailbox::TreeItem const*, uint)>, isUnknown=<optimized out>, value=<synthetic pointer>: <optimized out>, end=..., begin=...) at trojita/src/Common/FindWithUnknown.h:60
#4  Imap::Mailbox::Model::findMessageOrNextOneByUid (this=this@entry=0x564a07585f50, list=list@entry=0x564a0758f250, uid=uid@entry=969217) at trojita/src/Imap/Model/Model.cpp:1299
#5  0x0000564a05c1411f in Imap::Mailbox::TreeItemMailbox::handleVanished (this=<optimized out>, model=<optimized out>, resp=...) at trojita/src/Imap/Model/MailboxTree.cpp:622
#6  0x0000564a05c79c76 in Imap::Mailbox::ObtainSynchronizedMailboxTask::handleVanished (this=0x564a077eaf20, resp=0x564a085f7ae0) at trojita/src/Imap/Tasks/ObtainSynchronizedMailboxTask.cpp:849
#7  0x0000564a05c2cdaf in Imap::Mailbox::Model::responseReceived (this=this@entry=0x564a07585f50, it=..., it@entry=...) at trojita/src/Imap/Model/Model.cpp:221
#8  0x0000564a05c2d3de in Imap::Mailbox::Model::responseReceived (this=0x564a07585f50, parser=0x564a077d8b30) at trojita/src/Imap/Model/Model.cpp:163
#9  0x00007ff71b4bf499 in QObject::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#10 0x00007ff71bd75b8c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#11 0x00007ff71bd7d341 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#12 0x00007ff71b4929e0 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#13 0x00007ff71b49516d in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#14 0x00007ff71b4e6c43 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#15 0x00007ff718a167f7 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#16 0x00007ff718a16a60 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#17 0x00007ff718a16b0c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#18 0x00007ff71b4e704f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#19 0x00007ff71b4909ca in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#20 0x00007ff71b49913c in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#21 0x0000564a05adcce5 in main (argc=<optimized out>, argv=<optimized out>) at trojita/src/Gui/main.cpp:218
(gdb) next
Common::linearLowerBoundWithUnknownElements<QTypedArrayData<Imap::Mailbox::TreeItem*>::iterator, unsigned int, bool (*)(Imap::Mailbox::TreeItem const*), bool (*)(Imap::Mailbox::TreeItem const*, unsigned int)> (lessThan=0x564a05c218e0 <(anonymous namespace)::uidComparator(Imap::Mailbox::TreeItem const*, uint)>, isUnknown=<optimized out>, value=<synthetic pointer>: 969217, end=..., begin=...) at trojita/src/Common/FindWithUnknown.h:38
38              if (isUnknown(*begin)) {
(gdb) next
Common::lowerBoundWithUnknownElements<QTypedArrayData<Imap::Mailbox::TreeItem*>::iterator, unsigned int, bool (*)(Imap::Mailbox::TreeItem const*), bool (*)(Imap::Mailbox::TreeItem const*, unsigned int)> (lessThan=0x564a05c218e0 <(anonymous namespace)::uidComparator(Imap::Mailbox::TreeItem const*, uint)>, isUnknown=<optimized out>, value=<synthetic pointer>: 969217, end=..., begin=...) at trojita/src/Common/FindWithUnknown.h:60
60                  return linearLowerBoundWithUnknownElements(begin, begin + n, value, isUnknown, lessThan);
(gdb) next
Comment 3 Jan Kundrát 2018-07-03 14:04:31 UTC
(a duplicate bug led me here, so I think that this is a correct report)

1) activate threading
2) open a mailbox
3) perform a search which returns something
4) switch to another mailbox where that search doesn't return anything
5) the threading is still preserved, and trojita assert-crashes:

ASSERT: "it != ptrToInternal.constEnd()" in file trojita/src/Imap/Model/ThreadingMsgListModel.cpp, line 1488
Comment 4 Erik Quaeghebeur 2023-03-11 22:34:49 UTC
(In reply to Jan Kundrát from comment #3)
> 
> 1) activate threading
> 2) open a mailbox
> 3) perform a search which returns something
> 4) switch to another mailbox where that search doesn't return anything
> 5) the threading is still preserved, and trojita assert-crashes:
> 
> ASSERT: "it != ptrToInternal.constEnd()" in file
> trojita/src/Imap/Model/ThreadingMsgListModel.cpp, line 1488

I cannot reproduce this with my current Trojitá (~git master). So unless someone can reproduce it with a recent version (from git), I suggest we close this.
Comment 5 Bug Janitor Service 2023-03-26 03:45:32 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 6 Bug Janitor Service 2023-04-10 03:45:42 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!