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 61 #867

Open
ctrlaltca opened this issue Feb 5, 2025 · 1 comment
Labels
crash A crash occurs in the library code

Comments

@ctrlaltca
Copy link

ctrlaltca commented Feb 5, 2025

Describe the bug
This is basically #588, occurring on a build from current libQuotient and Neochat.
, .

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

  1. Create a new room
  2. Set topic, image and room alias
  3. Quit and restart, open the room => crash on assertion.

Expected behavior
Don't crash

Additional context

(gdb) bt full
#0  0x00007ffff2c9c9cb in pthread_kill@@GLIBC_2.34 () at /lib64/libc.so.6
#1  0x00007ffff2c43772 in raise () at /lib64/libc.so.6
#2  0x00007ffff2c28ed7 in abort () at /lib64/libc.so.6
#3  0x00007ffff34c678b in ??? () at /usr/lib64/libQt6Core.so.6
#4  0x00007ffff351d15a in ??? () at /usr/lib64/libQt6Core.so.6
#5  0x00007ffff34c7cd2 in QMessageLogger::fatal(char const*, ...) const () at /usr/lib64/libQt6Core.so.6
#6  0x00007ffff34c67e7 in qt_assert(char const*, char const*, int) () at /usr/lib64/libQt6Core.so.6
#7  0x0000000000a40601 in Quotient::EventStats::updateOnMarkerMove (this=0x228abe8, room=0x276cf70, oldMarker=..., newMarker=...) at /home/fabio/libQuotient/Quotient/eventstats.cpp:61
        newStats = {notableCount = 140737488337504, highlightCount = 140737488337584, isEstimate = 96}
#8  0x00000000009ba369 in Quotient::Room::Private::setLocalLastReadReceipt (this=0x228aa70, newMarker=..., newReceipt=..., deferStatsUpdate=false)
    at /home/fabio/libQuotient/Quotient/room.cpp:842
        prevEventId = std::optional = {[contained value] = "$yW5nZJM9jSrWDQKM-7R2t23nJ1TK3Zl_YOEEeZuWLzs"}
        changes = {i = 32768}
#9  0x00000000009bb630 in Quotient::Room::Private::setFullyReadMarker (this=0x228aa70, eventId="$U7KgNOqQgIRHxNeVNGLU0ay4duoH0QfQPRqaaXAuuBg")
    at /home/fabio/libQuotient/Quotient/room.cpp:968
        rm = {<std::iterator<std::random_access_iterator_tag, Quotient::TimelineItem, long, Quotient::TimelineItem const*, Quotient::TimelineItem const&>> = {<No data fields>}, current = {<Quotient::EventItemBase> = {evt = std::unique_ptr<Quotient::RoomEvent> = {get() = 0x7fffe0002790}, data = std::any [no contained value]}, idx = -10}}
        prevReadMarker = {<std::iterator<std::random_access_iterator_tag, Quotient::TimelineItem, long, Quotient::TimelineItem const*, Quotient::TimelineItem const&>> = {<No data fields>}, current = {<Quotient::EventItemBase> = {evt = std::unique_ptr<Quotient::RoomEvent> = {get() = 0x3738ad0}, data = std::any [no contained value]}, idx = -11}}
        newReadMarker = {<std::iterator<std::random_access_iterator_tag, Quotient::TimelineItem, long, Quotient::TimelineItem const*, Quotient::TimelineItem const&>> = {<No data fields>}, current = {<Quotient::EventItemBase> = {evt = std::unique_ptr<Quotient::RoomEvent> = {get() = 0x7fffe0002790}, data = std::any [no contained value]}, idx = -10}}
        prevFullyReadId = ""
        changes = {i = 32768}
#10 0x00000000009baa78 in Quotient::Room::Private::updateStats (this=0x228aa70, from=..., to=...) at /home/fabio/libQuotient/Quotient/room.cpp:882
        fullyReadMarker = {<std::iterator<std::random_access_iterator_tag, Quotient::TimelineItem, long, Quotient::TimelineItem const*, Quotient::TimelineItem const&>> = {<No data fields>}, current = {<Quotient::EventItemBase> = {evt = std::unique_ptr<Quotient::RoomEvent> = {get() = 0x3738ad0}, data = std::any [no contained value]}, idx = -11}}
        readReceiptMarker = {<std::iterator<std::random_access_iterator_tag, Quotient::TimelineItem, long, Quotient::TimelineItem const*, Quotient::TimelineItem const&>> = {<No data fields>}, current = {<Quotient::EventItemBase> = {evt = std::unique_ptr<Quotient::RoomEvent> = {get() = 0x852cce0}, data = std::any [no contained value]}, idx = -8}}
        changes = {i = 0}
        newStats = {static staticMetaObject = {d = {superdata = {direct = 0x0}, stringdata = 0xd744c0 <qt_meta_stringdata_ZN8Quotient10EventStatsE>, data = 0xd74560 <qt_meta_data_ZN8Quotient10EventStatsE>, static_metacall = 0x8f3ec4 <Quotient::EventStats::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, metaTypes = 0x107f020 <qt_incomplete_metaTypeArray<(anonymous namespace)::qt_meta_tag_ZN8Quotient10EventStatsE_t, QtPrivate::TypeAndForceComplete<long long, std::integral_constant<bool, true> >, QtPrivate::TypeAndForceComplete<long long, std::integral_constant<bool, true> >, QtPrivate::TypeAndForceComplete<bool, std::integral_constant<bool, true> >, QtPrivate::TypeAndForceComplete<Quotient::EventStats, std::integral_constant<bool, true> >, QtPrivate::TypeAndForceComplete<bool, std::integral_constant<bool, false> > >>, extradata = 0x0}}, notableCount = 0, highlightCount = 0, isEstimate = 96}
        doAddStats = {__this = 0x7fffffffc330, __changes = @0x228aa70, __newStats = {static staticMetaObject = {d = {superdata = {direct = 0x0}, stringdata = 0xd744c0 <qt_meta_stringdata_ZN8Quotient10EventStatsE>, data = 0xd74560 <qt_meta_data_ZN8Quotient10EventStatsE>, static_metacall = 0x8f3ec4 <Quotient::EventStats::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, metaTypes = 0x107f020 <qt_incomplete_metaTypeArray<(anonymous namespace)::qt_meta_tag_ZN8Quotient10EventStatsE_t, QtPrivate::TypeAndForceComplete<long long, std::integral_constant<bool, true> >, QtPrivate::TypeAndForceComplete<long long, std::integral_constant<bool, true> >, QtPrivate::TypeAndForceComplete<bool, std::integral_constant<bool, true> >, QtPrivate::TypeAndForceComplete<Quotient::EventStats, std::integral_constant<bool, true> >, QtPrivate::TypeAndForceComplete<bool, std::integral_constant<bool, false> > >>, extradata = 0x0}}, notableCount = 140737488338736, highlightCount = 4619502, isEstimate = 64}}
#11 0x00000000009c6fab in operator() (__closure=0x6b950b0) at /home/fabio/libQuotient/Quotient/room.cpp:2382
        changes = @0x7fffffffc290: {i = 0}
        from = @0x7fffffffc298: {<std::iterator<std::random_access_iterator_tag, Quotient::TimelineItem, long, Quotient::TimelineItem const*, Quotient::TimelineItem const&>> = {<No data fields>}, current = {<Quotient::EventItemBase> = {evt = std::unique_ptr<Quotient::RoomEvent> = {get() = 0x3738ad0}, data = std::any [no contained value]}, idx = -11}}
#12 0x00000000009da4cb in operator() (__closure=0x7fffffffc3f0) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:141
#13 0x00000000009dacf4 in QtPrivate::FunctorCallBase::call_internal<void, QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, Quotient::Room::Private::getPreviousContent(int, const QString&)::<lambda()> >::call(Quotient::Room::Private::getPreviousContent(int, const QString&)::<lambda()>&, void**)::<lambda()> >(void **, struct {...} &&)
    (args=0x7fffffffc590, fn=...) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:65
#14 0x00000000009da501 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, Quotient::Room::Private::getPreviousContent(int, const QString&)::<lambda()> >::call(str--Type <RET> for more, q to quit, c to continue without paging--
uct {...} &, void **) (f=..., arg=0x7fffffffc590) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:140
#15 0x00000000009d997f in QtPrivate::FunctorCallable<Quotient::Room::Private::getPreviousContent(int, const QString&)::<lambda()> >::call<QtPrivate::List<>, void>(struct {...} &, void *, void **) (f=..., arg=0x7fffffffc590) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:362
#16 0x00000000009d89b1 in QtPrivate::QCallableObject<Quotient::Room::Private::getPreviousContent(int, const QString&)::<lambda()>, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=1, this_=0x6b950a0, r=0x276cf70, a=0x7fffffffc590, ret=0x0) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:572
        that = 0x6b950a0
#17 0x00007ffff3611935 in ??? () at /usr/lib64/libQt6Core.so.6
#18 0x00000000008f4e4d in Quotient::BaseJob::success (this=0x876ee30, _t1=0x876ee30) at /home/fabio/libQuotient/build/QuotientQt6_autogen/T4CFEN5LXH/moc_basejob.cpp:537
        _a = {0x0, 0x7fffffffc580}
#19 0x0000000000a70a9d in Quotient::BaseJob::finishJob (this=0x876ee30) at /home/fabio/libQuotient/Quotient/jobs/basejob.cpp:618
#20 0x0000000000a6de70 in operator() (__closure=0x1eb2420) at /home/fabio/libQuotient/Quotient/jobs/basejob.cpp:372
#21 0x0000000000a72edd in operator() (__closure=0x7fffffffc6f0) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:141
#22 0x0000000000a7303b in QtPrivate::FunctorCallBase::call_internal<void, QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, Quotient::BaseJob::sendRequest()::<lambda()> >::call(Quotient::BaseJob::sendRequest()::<lambda()>&, void**)::<lambda()> >(void **, struct {...} &&) (args=0x7fffffffc828, fn=...) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:65
#23 0x0000000000a72f13 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, Quotient::BaseJob::sendRequest()::<lambda()> >::call(struct {...} &, void **)
    (f=..., arg=0x7fffffffc828) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:140
#24 0x0000000000a72d49 in QtPrivate::FunctorCallable<Quotient::BaseJob::sendRequest()::<lambda()> >::call<QtPrivate::List<>, void>(struct {...} &, void *, void **)
    (f=..., arg=0x7fffffffc828) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:362
#25 0x0000000000a72b77 in QtPrivate::QCallableObject<Quotient::BaseJob::sendRequest()::<lambda()>, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=1, this_=0x1eb2410, r=0x876ee30, a=0x7fffffffc828, ret=0x0) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:572
        that = 0x1eb2410
#26 0x00007ffff3611935 in ??? () at /usr/lib64/libQt6Core.so.6
#27 0x00007ffff360e4af in QObject::event(QEvent*) () at /usr/lib64/libQt6Core.so.6
#28 0x00007ffff4d97975 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib64/libQt6Widgets.so.6
#29 0x00007ffff35a7c08 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib64/libQt6Core.so.6
#30 0x00007ffff35ac201 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /usr/lib64/libQt6Core.so.6
#31 0x00007ffff38d4bf7 in ??? () at /usr/lib64/libQt6Core.so.6
#32 0x00007ffff330512f in ??? () at /usr/lib64/libglib-2.0.so.0
#33 0x00007ffff3307147 in ??? () at /usr/lib64/libglib-2.0.so.0
#34 0x00007ffff330784c in g_main_context_iteration () at /usr/lib64/libglib-2.0.so.0
#35 0x00007ffff38d4cb3 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt6Core.so.6
#36 0x00007ffff35b5a45 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt6Core.so.6
#37 0x00007ffff35b1391 in QCoreApplication::exec() () at /usr/lib64/libQt6Core.so.6
#38 0x0000000000466886 in main (argc=1, argv=0x7fffffffd9e8) at /home/fabio/prj/neochat/src/main.cpp:308
        app = <incomplete type>
        about = {d = std::unique_ptr<KAboutDataPrivate> = {get() = 0x16ad180}}
        colorScheme = {<QObject> = {<No data fields>}, static staticMetaObject = {d = {superdata = {direct = 0x7ffff3ad8b20 <QObject::staticMetaObject>}, stringdata = 0xb4c080 <qt_meta_stringdata_ZN12ColorSchemerE>, data = 0xb4c160 <qt_meta_data_ZN12ColorSchemerE>, static_metacall = 0x59921e <ColorSchemer::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, metaTypes = 0x106d900 <qt_metaTypeArray<QAbstractItemModel*, ColorSchemer, void, int, int>>, extradata = 0x0}}}
        parser = {d = 0x185d590}
        testOption = {d = {d = 0x18fd0d0}}
        dbusActivatedOption = {d = {d = 0x1900f00}}
        shareOption = {d = {d = 0x1901a20}}
        service = <incomplete type>
        staticorg_kde_neochat_settingsPluginInstance = {<No data fields>}
        staticorg_kde_neochat_timelinePluginInstance = {<No data fields>}
        staticorg_kde_neochat_devtoolsPluginInstance = {<No data fields>}
        staticorg_kde_neochat_loginPluginInstance = {<No data fields>}
        staticorg_kde_neochat_chatbarPluginInstance = {<No data fields>}
        engine = <incomplete type>
--Type <RET> for more, q to quit, c to continue without paging--
        runner = 0x109e820 <Runner::create(QQmlEngine*, QJSEngine*)::instance>
        window = 0x186fb80
#7  0x0000000000a40601 in Quotient::EventStats::updateOnMarkerMove (this=0x228abe8, room=0x276cf70, oldMarker=..., newMarker=...) at /home/fabio/libQuotient/Quotient/eventstats.cpp:61
61          Q_ASSERT(oldMarker > newMarker);
(gdb) p oldMarker
$1 = (const Quotient::EventStats::marker_t &) @0x7fffffffbba0: {<std::iterator<std::random_access_iterator_tag, Quotient::TimelineItem, long, Quotient::TimelineItem const*, Quotient::TimelineItem const&>> = {<No data fields>}, 
  current = {<Quotient::EventItemBase> = {evt = std::unique_ptr<Quotient::RoomEvent> = {get() = 0x852cce0}, data = std::any [no contained value]}, idx = -8}}
(gdb) p newMarker
$2 = (const Quotient::EventStats::marker_t &) @0x7fffffffbca0: {<std::iterator<std::random_access_iterator_tag, Quotient::TimelineItem, long, Quotient::TimelineItem const*, Quotient::TimelineItem const&>> = {<No data fields>}, 
  current = {<Quotient::EventItemBase> = {evt = std::unique_ptr<Quotient::RoomEvent> = {get() = 0x7fffe0002790}, data = std::any [no contained value]}, idx = -10}}
(gdb) p room->d->timeline
$7 = std::deque with 11 elements = {
  {<Quotient::EventItemBase> = {
    evt = std::unique_ptr<Quotient::RoomEvent> = {get() = 0x3738ad0}, data = std::any [no contained value]}, idx = -11}, 
  {<Quotient::EventItemBase> = {
    evt = std::unique_ptr<Quotient::RoomEvent> = {get() = 0x7fffe0002790}, data = std::any [no contained value]}, idx = -10},
  {<Quotient::EventItemBase> = {
    evt = std::unique_ptr<Quotient::RoomEvent> = {get() = 0x63ff7b0}, data = std::any [no contained value]}, idx = -9},
  {<Quotient::EventItemBase> = {
    evt = std::unique_ptr<Quotient::RoomEvent> = {get() = 0x852cce0}, data = std::any [no contained value]}, idx = -8}, 
  {<Quotient::EventItemBase> = {
    evt = std::unique_ptr<Quotient::RoomEvent> = {get() = 0x941b470}, data = std::any [no contained value]}, idx = -7}, 
  {<Quotient::EventItemBase> = {
    evt = std::unique_ptr<Quotient::RoomEvent> = {get() = 0x7fff9c061ef0}, data = std::any [no contained value]}, idx = -6}, 
  {<Quotient::EventItemBase> = {
    evt = std::unique_ptr<Quotient::RoomEvent> = {get() = 0x7fff9c1903c0}, data = std::any [no contained value]}, idx = -5}, 
  {<Quotient::EventItemBase> = {
    evt = std::unique_ptr<Quotient::RoomEvent> = {get() = 0x7fff9c0d28a0}, data = std::any [no contained value]}, idx = -4}, 
  {<Quotient::EventItemBase> = {
    evt = std::unique_ptr<Quotient::RoomEvent> = {get() = 0x9328d20}, data = std::any [no contained value]}, idx = -3}, 
  {<Quotient::EventItemBase> = {
    evt = std::unique_ptr<Quotient::RoomEvent> = {get() = 0x39582c0}, data = std::any [no contained value]}, idx = -2},
  {<Quotient::EventItemBase> = {
    evt = std::unique_ptr<Quotient::RoomEvent> = {get() = 0x5a4cb20}, data = std::any [no contained value]}, idx = -1}
}
@KitsuneRal
Copy link
Member

Yay, thanks for the reproducer! I've been hunting for it.

@KitsuneRal KitsuneRal added the crash A crash occurs in the library code label Feb 5, 2025
@KitsuneRal KitsuneRal moved this to 0.9 - To Do in libQuotient 1 Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash A crash occurs in the library code
Projects
Status: 0.9 - To Do
Development

No branches or pull requests

2 participants