Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASSERT: "oldMarker > newMarker" in file libquotient/lib/eventstats.cpp, line 59 #588

Closed
TobiasFella opened this issue Nov 17, 2022 · 9 comments · Fixed by #661
Closed

ASSERT: "oldMarker > newMarker" in file libquotient/lib/eventstats.cpp, line 59 #588

TobiasFella opened this issue Nov 17, 2022 · 9 comments · Fixed by #661
Labels
bug/fix The library doesn't work as expected crash A crash occurs in the library code

Comments

@TobiasFella
Copy link
Member

TobiasFella commented Nov 17, 2022

To Reproduce
Steps to reproduce the behaviour, and the description of the actual result:

  1. Create a room; open it; do not send any messages
  2. Close NeoChat
  3. Crash

Is it environment-specific?

  • OS: Fedora 36
  • Version of the library: dev
  • NeoChat from master branch
  • Linkage: dynamic
ASSERT: "oldMarker > newMarker" in file /home/tobias/kde/src/libquotient/lib/eventstats.cpp, line 59

Thread 1 "neochat" received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
Downloading 0.00 MB source file /usr/src/debug/glibc-2.36-7.fc37.x86_64/nptl/pthread_kill.c
44            return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;                            
(gdb) bt
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0)
    at pthread_kill.c:44
#1  0x00007ffff3cb0ee3 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
#2  0x00007ffff3c60aa6 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007ffff3c4a7fc in __GI_abort () at abort.c:79
#4  0x00007ffff42b14d5 in qt_message_fatalPython Exception <class 'gdb.error'>: value has been optimized out
 (message=<synthetic pointer>, context=<optimized out>)
    at global/qlogging.cpp:1914
#5  QMessageLogger::fatal(char const*, ...) const
    (this=this@entry=0x7fffffffc328, msg=msg@entry=0x7ffff4572000 "ASSERT: \"%s\" in file %s, line %d")
    at global/qlogging.cpp:893
#6  0x00007ffff42b0818 in qt_assert(char const*, char const*, int)
    (assertion=<optimized out>, file=<optimized out>, line=<optimized out>) at global/qglobal.cpp:3366
#7  0x00007ffff6f6b4a5 in Quotient::EventStats::updateOnMarkerMove(Quotient::Room const*, std::reverse_iterator<std::_Deque_iterator<Quotient::TimelineItem, Quotient::TimelineItem const&, Quotient::TimelineItem const*> > const&, std::reverse_iterator<std::_Deque_iterator<Quotient::TimelineItem, Quotient::TimelineItem const&, Quotient::TimelineItem const*> > const&) (this=0x2c05b00, room=0x2c04970, oldMarker=..., newMarker=...)
    at /home/tobias/kde/src/libquotient/lib/eventstats.cpp:59
#8  0x00007ffff6f0150b in Quotient::Room::Private::setLocalLastReadReceipt(std::reverse_iterator<std::_Deque_iterator<Quotient::TimelineItem, Quotient::TimelineItem const&, Quotient::TimelineItem const*> > const&, Quotient::ReadReceipt, bool) (this=0x2c059c0, newMarker=..., newReceipt=..., deferStatsUpdate=false)
    at /home/tobias/kde/src/libquotient/lib/room.cpp:773
#9  0x00007ffff6f02ba0 in Quotient::Room::Private::setFullyReadMarker(QString const&)
    (this=0x2c059c0, eventId="$nIN24wtNpgc75ZBc2QVm_5qJajoX-nur7LrgfrjBkpQ")
    at /home/tobias/kde/src/libquotient/lib/room.cpp:895
#10 0x00007ffff6f01db6 in Quotient::Room::Private::updateStats(std::reverse_iterator<std::_Deque_iterator<Quotient::TimelineItem, Quotient::TimelineItem const&, Quotient::TimelineItem const*> > const&, std::reverse_iterator<std::_Deque_iterator<Quotient::TimelineItem, Quotient::TimelineItem const&, Quotient::TimelineItem const*> > const&)
    (this=0x2c059c0, from=..., to=...) at /home/tobias/kde/src/libquotient/lib/room.cpp:810
#11 0x00007ffff6f1735a in Quotient::Room::Private::addHistoricalMessageEvents(std::vector<std::unique_ptr<Quotient::RoomEvent, std::default_delete<Quotient::RoomEvent> >, std::allocator<std::unique_ptr<Quotient::RoomEvent, std::default_delete<Quotient::RoomEvent> > > >&&) (this=0x2c059c0, events=...)
    at /home/tobias/kde/src/libquotient/lib/room.cpp:2982
#12 0x00007ffff6f0ff02 in operator()() const (__closure=0x44b8f20)
    at /home/tobias/kde/src/libquotient/lib/room.cpp:2397
#13 0x00007ffff6f23843 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, Quotient::Room::Private::getPreviousContent(int, const QString&)::<lambda()> >::call(struct {...} &, void **)
    (f=..., arg=0x7fffffffcee0) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:146
#14 0x00007ffff6f22fe4 in QtPrivate::Functor<Quotient::Room::Private::getPreviousContent(int, const QString&)::<lambda()>, 0>::call<QtPrivate::List<>, void>(struct {...} &, void *, void **) (f=..., arg=0x7fffffffcee0)
    at /usr/include/qt5/QtCore/qobjectdefs_impl.h:256
#15 0x00007ffff6f21dd0 in QtPrivate::QFunctorSlotObject<Quotient::Room::Private::getPreviousContent(int, const QString&)::<lambda()>, 0, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *)
    (which=1, this_=0x44b8f10, r=0x2c04970, a=0x7fffffffcee0, ret=0x0)
    at /usr/include/qt5/QtCore/qobjectdefs_impl.h:443
#16 0x00007ffff44db9a6 in QtPrivate::QSlotObjectBase::call(QObject*, void**)
    (a=0x7fffffffcee0, r=<optimized out>, this=0x44b8f10)
    at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#17 doActivate<false>(QObject*, int, void**) (sender=0x43b8fd0, signal_index=10, argv=0x7fffffffcee0)
    at kernel/qobject.cpp:3919
#18 0x00007ffff6e780f9 in Quotient::BaseJob::success(Quotient::BaseJob*) (this=0x43b8fd0, _t1=0x43b8fd0)
    at /home/tobias/kde/build/libquotient/Quotient_autogen/3INUWTIJ2C/moc_basejob.cpp:542
#19 0x00007ffff6f9f9fa in Quotient::BaseJob::finishJob() (this=0x43b8fd0)
    at /home/tobias/kde/src/libquotient/lib/jobs/basejob.cpp:633
#20 0x00007ffff6f9c5aa in operator()() const (__closure=0x940420)
--Type <RET> for more, q to quit, c to continue without paging--
    at /home/tobias/kde/src/libquotient/lib/jobs/basejob.cpp:377
#21 0x00007ffff6fa0f29 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, Quotient::BaseJob::sendRequest()::<lambda()> >::call(struct {...} &, void **) (f=..., arg=0x7fffffffd150)
    at /usr/include/qt5/QtCore/qobjectdefs_impl.h:146
#22 0x00007ffff6fa0eab in QtPrivate::Functor<Quotient::BaseJob::sendRequest()::<lambda()>, 0>::call<QtPrivate::List<>, void>(struct {...} &, void *, void **) (f=..., arg=0x7fffffffd150)
    at /usr/include/qt5/QtCore/qobjectdefs_impl.h:256
#23 0x00007ffff6fa0dc6 in QtPrivate::QFunctorSlotObject<Quotient::BaseJob::sendRequest()::<lambda()>, 0, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *)
    (which=1, this_=0x940410, r=0x43b8fd0, a=0x7fffffffd150, ret=0x0)
    at /usr/include/qt5/QtCore/qobjectdefs_impl.h:443
#24 0x00007ffff44db9a6 in QtPrivate::QSlotObjectBase::call(QObject*, void**)
    (a=0x7fffffffd150, r=<optimized out>, this=0x940410)
    at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#25 doActivate<false>(QObject*, int, void**) (sender=0x944d00, signal_index=10, argv=0x7fffffffd150)
    at kernel/qobject.cpp:3919
#26 0x00007ffff44d6927 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**)
    (sender=sender@entry=0x944d00, m=m@entry=0x7ffff5ff9360 <QNetworkReply::staticMetaObject>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x0) at kernel/qobject.cpp:3979
#27 0x00007ffff5f97377 in QNetworkReply::finished() (this=this@entry=0x944d00) at .moc/moc_qnetworkreply.cpp:404
#28 0x00007ffff5f0ccf8 in QNetworkReplyHttpImplPrivate::finished() (this=0x37c95a0)
    at access/qnetworkreplyhttpimpl.cpp:2280
#29 0x00007ffff44d2c44 in QObject::event(QEvent*) (this=0x944d00, e=0x7fff8c05e5a0) at kernel/qobject.cpp:1347
#30 0x00007ffff51aed02 in QApplicationPrivate::notify_helper(QObject*, QEvent*)
    (this=<optimized out>, receiver=0x944d00, e=0x7fff8c05e5a0) at kernel/qapplication.cpp:3637
#31 0x00007ffff44a81c8 in QCoreApplication::notifyInternal2(QObject*, QEvent*)
    (receiver=0x944d00, event=0x7fff8c05e5a0) at kernel/qcoreapplication.cpp:1064
#32 0x00007ffff44ab534 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*)
    (receiver=0x0, event_type=0, data=0x671260) at kernel/qcoreapplication.cpp:1821
#33 0x00007ffff44f9537 in postEventSourceDispatch(GSource*, GSourceFunc, gpointer) (s=0x6eac90)
    at kernel/qeventdispatcher_glib.cpp:277
#34 0x00007ffff395ccbf in g_main_dispatch (context=0x7fffdc005010) at ../glib/gmain.c:3444
#35 g_main_context_dispatch (context=0x7fffdc005010) at ../glib/gmain.c:4162
#36 0x00007ffff39b2598 in g_main_context_iterate.constprop.0
    (context=0x7fffdc005010, block=1, dispatch=1, self=<optimized out>) at ../glib/gmain.c:4238
#37 0x00007ffff3959f40 in g_main_context_iteration (context=0x7fffdc005010, may_block=1) at ../glib/gmain.c:4303
#38 0x00007ffff44f902a in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
    Python Exception <class 'gdb.error'>: value has been optimized out
 (this=0x6f7750, flags=) at kernel/qeventdispatcher_glib.cpp:423
#39 0x00007ffff44a6c1a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)
   Python Exception <class 'gdb.error'>: value has been optimized out
 (this=this@entry=0x7fffffffd620, flags=, flags@entry=QEventLoop::ProcessEventsFlag::QEventLoop::AllEvents)
    at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#40 0x00007ffff44aece2 in QCoreApplication::exec() () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#41 0x00000000004347c5 in main(int, char**) (argc=1, argv=0x7fffffffdbb8)
    at /home/tobias/kde/src/neochat/src/main.cpp:322
@TobiasFella TobiasFella added the bug/fix The library doesn't work as expected label Nov 17, 2022
@KitsuneRal
Copy link
Member

Somehow I cannot reproduce this in Quaternion, although the stack is clearly about Quotient... No matter which server I try.

@huth
Copy link

huth commented Feb 9, 2023

I'm testing Quaternion since a couple of days, and when I tried to start it today, I've got this assertion today, too:

ASSERT: "oldMarker > newMarker" in file /home/thuth/src/libQuotient/lib/eventstats.cpp, line 59

FWIW, I compiled libQuotient on my own from git, using commit e20f13f , and Quaternion using commit 0315b395584b184caf, using clang version 14.0.6 on RHEL 8.

My backtrace taken with gdb looks like this:

#0  0x00007ffff3800aff in raise () at /lib64/libc.so.6
#1  0x00007ffff37d3ea5 in abort () at /lib64/libc.so.6
#2  0x00007ffff4558147 in qt_message_output(QtMsgType, QMessageLogContext const&, QString const&) [clone .cold.117] ()
    at /lib64/libQt5Core.so.5
#3  0x00007ffff4557519 in qt_assert_x(char const*, char const*, char const*, int) () at /lib64/libQt5Core.so.5
#4  0x00000000005defc7 in Quotient::EventStats::updateOnMarkerMove(Quotient::Room const*, std::reverse_iterator<std::_Deque_iterator<Quotient::TimelineItem, Quotient::TimelineItem const&, Quotient::TimelineItem const*> > const&, std::reverse_iterator<std::_Deque_iterator<Quotient::TimelineItem, Quotient::TimelineItem const&, Quotient::TimelineItem const*> > const&)
    (this=0x1891940, room=0x1891770, oldMarker=..., newMarker=...) at /home/thuth/src/libQuotient/lib/eventstats.cpp:59
#5  0x0000000000584c56 in Quotient::Room::Private::setLocalLastReadReceipt(std::reverse_iterator<std::_Deque_iterator<Quotient::TimelineItem, Quotient::TimelineItem const&, Quotient::TimelineItem const*> > const&, Quotient::ReadReceipt, bool) (
    this=0x1891800, newMarker=..., newReceipt=..., deferStatsUpdate=false) at /home/thuth/src/libQuotient/lib/room.cpp:780
#6  0x00000000005a360e in Quotient::Room::processEphemeralEvent(std::unique_ptr<Quotient::Event, std::default_delete<Quotient::Event> >&&)::$_40::operator()(Quotient::ReceiptEvent const&) const (this=0x7fffffffc3a0, evt=...)
    at /home/thuth/src/libQuotient/lib/room.cpp:3278
#7  0x00000000005a3093 in Quotient::switchOnType<Quotient::Event, Quotient::Room::processEphemeralEvent(std::unique_ptr<Quotient::Event, std::default_delete<Quotient::Event> >&&)::$_40>(Quotient::Event const&, Quotient::Room::processEphemeralEvent(std::unique_ptr<Quotient::Event, std::default_delete<Quotient::Event> >&&)::$_40&&) (event=..., tail=...)
    at /home/thuth/src/libQuotient/lib/events/event.h:608
#8  0x0000000000596fb9 in Quotient::switchOnType<Quotient::Event, Quotient::Room::processEphemeralEvent(std::unique_ptr<Quotient::Event, std::default_delete<Quotient::Event> >&&)::$_41, Quotient::Room::processEphemeralEvent(std::unique_ptr<Quotient::Event, std::default_delete<Quotient::Event> >&&)::$_40>(Quotient::Event const&, Quotient::Room::processEphemeralEvent(std::unique_ptr<Quotient::Event, std::default_delete<Quotient::Event> >&&)::$_41&&, Quotient::Room::processEphemeralEvent(std::unique_ptr<Quotient::Event, std::default_delete<Quotient::Event> >&&)::$_40&&) (event=..., fn1=..., fns=...) at /home/thuth/src/libQuotient/lib/events/event.h:621
#9  0x0000000000596f50 in Quotient::Room::processEphemeralEvent(std::unique_ptr<Quotient::Event, std::default_delete<Quotient::Event> >&&) (this=0x1891770, event=...) at /home/thuth/src/libQuotient/lib/room.cpp:3234
#10 0x000000000058d46e in Quotient::Room::updateData(Quotient::SyncRoomData&&, bool) (this=0x1891770, data=..., fromCache=false)
    at /home/thuth/src/libQuotient/lib/room.cpp:1938
#11 0x000000000054d354 in Quotient::Connection::Private::consumeRoomData(std::vector<Quotient::SyncRoomData, std::allocator<Quotient::SyncRoomData> >&&, bool)::$_10::operator()() (this=0x1d79fb0) at /home/thuth/src/libQuotient/lib/connection.cpp:917
#12 0x000000000054d2f9 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, Quotient::Connection::Private::consumeRoomData(std::vector<Quotient::SyncRoomData, std::allocator<Quotient::SyncRoomData> >&&, bool)::$_10>::call(Quotient::Connection::Private::consumeRoomData(std::vector<Quotient::SyncRoomData, std::allocator<Quotient::SyncRoomData> >&&, bool)::$_10&, void**)
    (f=..., arg=0x1d7a0c8) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:146
#13 0x000000000054d2d1 in QtPrivate::Functor<Quotient::Connection::Private::consumeRoomData(std::vector<Quotient::SyncRoomData, std::allocator<Quotient::SyncRoomData> >&&, bool)::$_10, 0>::call<QtPrivate::List<>, void>(Quotient::Connection::Private::consumeRoomData(std::vector<Quotient::SyncRoomData, std::allocator<Quotient::SyncRoomData> >&&, bool)::$_10&, void*, void**)
    (f=..., arg=0x1d7a0c8) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:256
#14 0x000000000054d261 in QtPrivate::QFunctorSlotObject<Quotient::Connection::Private::consumeRoomData(std::vector<Quotient::SyncRoomData, std::allocator<Quotient::SyncRoomData> >&&, bool)::$_10, 0, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x1d79fa0, r=0x1891770, a=0x1d7a0c8, ret=0x0)
    at /usr/include/qt5/QtCore/qobjectdefs_impl.h:443
#15 0x00007ffff47780d3 in QObject::event(QEvent*) () at /lib64/libQt5Core.so.5
#16 0x00007ffff6a7f252 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib64/libQt5Widgets.so.5
#17 0x00007ffff6a85fd0 in QApplication::notify(QObject*, QEvent*) () at /lib64/libQt5Widgets.so.5
#18 0x00007ffff474b7a2 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib64/libQt5Core.so.5
#19 0x00007ffff474e591 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /lib64/libQt5Core.so.5
--Type <RET> for more, q to quit, c to continue without paging--
#20 0x00007ffff479fdb7 in postEventSourceDispatch(_GSource*, int (*)(void*), void*) () at /lib64/libQt5Core.so.5
#21 0x00007ffff244595d in g_main_context_dispatch () at /lib64/libglib-2.0.so.0
#22 0x00007ffff2445d18 in g_main_context_iterate.isra () at /lib64/libglib-2.0.so.0
#23 0x00007ffff2445db0 in g_main_context_iteration () at /lib64/libglib-2.0.so.0
#24 0x00007ffff479fb64 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5
#25 0x00007ffff474a4ab in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5
#26 0x00007ffff47528f4 in QCoreApplication::exec() () at /lib64/libQt5Core.so.5
#27 0x0000000000527a41 in main(int, char**) (argc=1, argv=0x7fffffffd4b8) at /home/thuth/src/Quaternion/client/main.cpp:195

Any ideas how to debug / fix this?

@KitsuneRal
Copy link
Member

Sorry, this slipped through the cracks. The stack trace looks materially identical to the one originally posted; thanks for confirming it's not a one-off. As to the way of debugging it - the state of variables (especially where newMarker points to in timeline, the size of this->timeline, and *prevEventId) at frame #5 would be very valuable. Maybe I can even solve the puzzle once I know these.

@huth
Copy link

huth commented Mar 3, 2023

After working around the crash three weeks ago, I wasn't able to reproduce it anymore. But if it happens again, I'll try to get the values that you requested.

@KitsuneRal
Copy link
Member

One more stacktrace with the same root cause, it seems: https://bugs.kde.org/show_bug.cgi?id=469089

@KitsuneRal KitsuneRal added the crash A crash occurs in the library code label Apr 28, 2023
@Akselmo
Copy link

Akselmo commented May 20, 2023

I get the crash too on Neochat master branch:

Application: NeoChat (neochat), signal: Aborted
Content of s_kcrashErrorMessage: std::unique_ptr<char []> = {get() = 0x0}
[KCrash Handler]
#5  0x00007fa0536b0844 in __pthread_kill_implementation () at /lib64/libc.so.6
#6  0x00007fa05365fabe in raise () at /lib64/libc.so.6
#7  0x00007fa05364887f in abort () at /lib64/libc.so.6
#8  0x00000000006ae569 in messageHandler(QtMsgType, QMessageLogContext const&, QString const&) (type=QtFatalMsg, context=..., message=...) at /home/akseli/Repositories/kde/src/neochat/src/logger.cpp:186
#9  0x00007fa053cecbd8 in qt_message_print(QtMsgType, QMessageLogContext const&, QString const&) () at /lib64/libQt5Core.so.5
#10 0x00007fa053ceccfe in qt_message(QtMsgType, QMessageLogContext const&, char const*, __va_list_tag*) () at /lib64/libQt5Core.so.5
#11 0x00007fa053cb186d in QMessageLogger::fatal(char const*, ...) const () at /lib64/libQt5Core.so.5
#12 0x00007fa053cb09f5 in qt_assert_x(char const*, char const*, char const*, int) () at /lib64/libQt5Core.so.5
#13 0x00007fa05674d787 in Quotient::EventStats::updateOnMarkerMove(Quotient::Room const*, std::reverse_iterator<std::_Deque_iterator<Quotient::TimelineItem, Quotient::TimelineItem const&, Quotient::TimelineItem const*> > const&, std::reverse_iterator<std::_Deque_iterator<Quotient::TimelineItem, Quotient::TimelineItem const&, Quotient::TimelineItem const*> > const&) (this=0x426c590, room=0x41b9730, oldMarker=..., newMarker=...) at /home/akseli/Repositories/kde/src/libquotient/Quotient/eventstats.cpp:58
#14 0x00007fa0566ed57f in Quotient::Room::Private::setLocalLastReadReceipt(std::reverse_iterator<std::_Deque_iterator<Quotient::TimelineItem, Quotient::TimelineItem const&, Quotient::TimelineItem const*> > const&, Quotient::ReadReceipt, bool) (this=0x426c450, newMarker=..., newReceipt=..., deferStatsUpdate=false) at /home/akseli/Repositories/kde/src/libquotient/Quotient/room.cpp:775
#15 0x00007fa0566ee93c in Quotient::Room::Private::setFullyReadMarker(QString const&) (this=0x426c450, eventId=...) at /home/akseli/Repositories/kde/src/libquotient/Quotient/room.cpp:897
#16 0x00007fa0566ef0bf in Quotient::Room::Private::markMessagesAsRead(std::reverse_iterator<std::_Deque_iterator<Quotient::TimelineItem, Quotient::TimelineItem const&, Quotient::TimelineItem const*> > const&) (this=0x426c450, upToMarker=...) at /home/akseli/Repositories/kde/src/libquotient/Quotient/room.cpp:933
#17 0x00007fa0566ef33a in Quotient::Room::markAllMessagesAsRead() (this=0x41b9730) at /home/akseli/Repositories/kde/src/libquotient/Quotient/room.cpp:957
#18 0x00007fa0566e6ba6 in Quotient::Room::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (_o=0x41b9730, _c=QMetaObject::InvokeMetaMethod, _id=97, _a=0x7fff54265670) at /home/akseli/Repositories/kde/build/libquotient/Quotient_autogen/include/moc_room.cpp:1197
#19 0x00007fa0566ea018 in Quotient::Room::qt_metacall(QMetaObject::Call, int, void**) (this=0x41b9730, _c=QMetaObject::InvokeMetaMethod, _id=97, _a=0x7fff54265670) at /home/akseli/Repositories/kde/build/libquotient/Quotient_autogen/include/moc_room.cpp:1857
#20 0x0000000000472866 in NeoChatRoom::qt_metacall(QMetaObject::Call, int, void**) (this=0x41b9730, _c=QMetaObject::InvokeMetaMethod, _id=102, _a=0x7fff54265670) at /home/akseli/Repositories/kde/build/neochat/src/neochat_autogen/EWIEGA46WW/moc_neochatroom.cpp:1188
#21 0x00007fa056cf444a in QQmlObjectOrGadget::metacall(QMetaObject::Call, int, void**) const () at /lib64/libQt5Qml.so.5
#22 0x00007fa056bc5b70 in CallPrecise(QQmlObjectOrGadget const&, QQmlPropertyData const&, QV4::ExecutionEngine*, QV4::CallData*, QMetaObject::Call) () at /lib64/libQt5Qml.so.5
#23 0x00007fa056bc8e02 in QV4::QObjectMethod::callInternal(QV4::Value const*, QV4::Value const*, int) const () at /lib64/libQt5Qml.so.5
#24 0x00007fa056bf9841 in QV4::Runtime::CallPropertyLookup::call(QV4::ExecutionEngine*, QV4::Value const&, unsigned int, QV4::Value*, int) () at /lib64/libQt5Qml.so.5
#25 0x00007fa00ecc3c56 in  ()
#26 0x0000000000000000 in  ()
[Inferior 1 (process 69768) detached]

Another:

Application: NeoChat (neochat), signal: Aborted
Content of s_kcrashErrorMessage: std::unique_ptr<char []> = {get() = 0x0}
[KCrash Handler]
#5  0x00007fb8e7cb0844 in __pthread_kill_implementation () at /lib64/libc.so.6
#6  0x00007fb8e7c5fabe in raise () at /lib64/libc.so.6
#7  0x00007fb8e7c4887f in abort () at /lib64/libc.so.6
#8  0x00000000006b225d in messageHandler(QtMsgType, QMessageLogContext const&, QString const&) (type=QtFatalMsg, context=..., message=...) at /home/akseli/Repositories/kde/src/neochat/src/logger.cpp:186
#9  0x00007fb8e82ecbd8 in qt_message_print(QtMsgType, QMessageLogContext const&, QString const&) () at /lib64/libQt5Core.so.5
#10 0x00007fb8e82eccfe in qt_message(QtMsgType, QMessageLogContext const&, char const*, __va_list_tag*) () at /lib64/libQt5Core.so.5
#11 0x00007fb8e82b186d in QMessageLogger::fatal(char const*, ...) const () at /lib64/libQt5Core.so.5
#12 0x00007fb8e82b09f5 in qt_assert_x(char const*, char const*, char const*, int) () at /lib64/libQt5Core.so.5
#13 0x00007fb8eab4e523 in Quotient::EventStats::updateOnMarkerMove(Quotient::Room const*, std::reverse_iterator<std::_Deque_iterator<Quotient::TimelineItem, Quotient::TimelineItem const&, Quotient::TimelineItem const*> > const&, std::reverse_iterator<std::_Deque_iterator<Quotient::TimelineItem, Quotient::TimelineItem const&, Quotient::TimelineItem const*> > const&) (this=0x2cb68b0, room=0x2cb4230, oldMarker=..., newMarker=...) at /home/akseli/Repositories/kde/src/libquotient/Quotient/eventstats.cpp:58
#14 0x00007fb8eaaed98b in Quotient::Room::Private::setLocalLastReadReceipt(std::reverse_iterator<std::_Deque_iterator<Quotient::TimelineItem, Quotient::TimelineItem const&, Quotient::TimelineItem const*> > const&, Quotient::ReadReceipt, bool) (this=0x2cb6770, newMarker=..., newReceipt=..., deferStatsUpdate=false) at /home/akseli/Repositories/kde/src/libquotient/Quotient/room.cpp:775
#15 0x00007fb8eaaeed48 in Quotient::Room::Private::setFullyReadMarker(QString const&) (this=0x2cb6770, eventId=...) at /home/akseli/Repositories/kde/src/libquotient/Quotient/room.cpp:897
#16 0x00007fb8eaaef4cb in Quotient::Room::Private::markMessagesAsRead(std::reverse_iterator<std::_Deque_iterator<Quotient::TimelineItem, Quotient::TimelineItem const&, Quotient::TimelineItem const*> > const&) (this=0x2cb6770, upToMarker=...) at /home/akseli/Repositories/kde/src/libquotient/Quotient/room.cpp:933
#17 0x00007fb8eaaef746 in Quotient::Room::markAllMessagesAsRead() (this=0x2cb4230) at /home/akseli/Repositories/kde/src/libquotient/Quotient/room.cpp:957
#18 0x00007fb8eaae6fb2 in Quotient::Room::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (_o=0x2cb4230, _c=QMetaObject::InvokeMetaMethod, _id=97, _a=0x7fffd9a04c50) at /home/akseli/Repositories/kde/build/libquotient/Quotient_autogen/include/moc_room.cpp:1197
#19 0x00007fb8eaaea424 in Quotient::Room::qt_metacall(QMetaObject::Call, int, void**) (this=0x2cb4230, _c=QMetaObject::InvokeMetaMethod, _id=97, _a=0x7fffd9a04c50) at /home/akseli/Repositories/kde/build/libquotient/Quotient_autogen/include/moc_room.cpp:1857
#20 0x0000000000472e1c in NeoChatRoom::qt_metacall(QMetaObject::Call, int, void**) (this=0x2cb4230, _c=QMetaObject::InvokeMetaMethod, _id=102, _a=0x7fffd9a04c50) at /home/akseli/Repositories/kde/build/neochat/src/neochat_autogen/EWIEGA46WW/moc_neochatroom.cpp:1188
#21 0x00007fb8eb0f444a in QQmlObjectOrGadget::metacall(QMetaObject::Call, int, void**) const () at /lib64/libQt5Qml.so.5
#22 0x00007fb8eafc5b70 in CallPrecise(QQmlObjectOrGadget const&, QQmlPropertyData const&, QV4::ExecutionEngine*, QV4::CallData*, QMetaObject::Call) () at /lib64/libQt5Qml.so.5
#23 0x00007fb8eafc8e02 in QV4::QObjectMethod::callInternal(QV4::Value const*, QV4::Value const*, int) const () at /lib64/libQt5Qml.so.5
#24 0x00007fb8eaff9841 in QV4::Runtime::CallPropertyLookup::call(QV4::ExecutionEngine*, QV4::Value const&, unsigned int, QV4::Value*, int) () at /lib64/libQt5Qml.so.5
#25 0x00007fb89c033436 in  ()
#26 0x0000000000000000 in  ()
[Inferior 1 (process 237360) detached]

@Akselmo
Copy link

Akselmo commented May 25, 2023

Poked around with GDB, not sure if I did it right (especially since I'm using kdesrc-run neochat)

I managed to get it to crash in here:

Q_ASSERT(isValidFor(room, oldMarker));

@KitsuneRal
Copy link
Member

@Akselmo - see #588 (comment)

@KitsuneRal
Copy link
Member

KitsuneRal commented May 28, 2023

With quite a few assumptions while analysing the code, it looks like unreadStats comes messed up when a read receipt is updated (locally or externally - doesn't matter). Those data initially are loaded from the local cache but that loaded state is checked for validity right afterwards. Something might be breaking the validity of unreadStats and I suspect it's Room::resetNotificationCount() that never quite did what it claimed to do and therefore was deprecated in 0.7, once we got a better code to count unread messages. Only NeoChat calls it so far (Quaternion doesn't, for some time), and the assertion failures above all come from NeoChat; so probably that's the culprit.

I planned to remove that (and Room::resetHighlightCount(), sharing the same problem) anyway, so will make a PR to that effect shortly; and I just coordinated the removal with the NeoChat project. https://invent.kde.org/network/neochat/-/merge_requests/1021 hopefully will fix it. Please keep this issue open for now.

KitsuneRal added a commit that referenced this issue May 28, 2023
They were deprecated since 0.7 and now seem to break unread counts logic
implemented in 0.7 (see #588).
@KitsuneRal KitsuneRal moved this to 0.8 - Done in libQuotient 1 May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/fix The library doesn't work as expected crash A crash occurs in the library code
Projects
Status: 0.8 - Done
Development

Successfully merging a pull request may close this issue.

4 participants