Summary: | Crashes with segmentation fault when trying to enter "Security" or "Device" settings, or maybe others. | ||
---|---|---|---|
Product: | [Applications] NeoChat | Reporter: | dreieck <felics-kde> |
Component: | General | Assignee: | Tobias Fella <fella> |
Status: | REOPENED --- | ||
Severity: | crash | CC: | begasus, carl, felics-kde, josh, treble-acid-copied |
Priority: | NOR | Keywords: | qt6 |
Version: | 24.08.2 | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
Terminal output of a run of `gdb neochat`.
Terminal output and syslog event on one of the crashes on Haiku |
Description
dreieck
2024-11-03 13:49:21 UTC
Note that I do _not_ see this issue with a local build of the -git variant of this software. Note that in a local build of the latest state from git, the "Security" settings work, but for the "Devices" settings I still see a crash. I have built with debugging informaten (-DCMAKE_BUILD_TYPE=RelWithDebInfo). Terminal output at crash: ``` [...] qrc:/qt/qml/org/kde/neochat/login/Loading.qml:26: TypeError: Cannot read property 'closeDialog' of null qrc:/qt/qml/org/kde/neochat/login/Loading.qml:26: TypeError: Cannot read property 'closeDialog' of null qrc:/qt/qml/org/kde/neochat/login/Loading.qml:26: TypeError: Cannot read property 'closeDialog' of null qt.core.qobject.connect: QObject::connect(Quotient::Connection, DevicesModel): invalid nullptr parameter qrc:/qt/qml/org/kde/kirigami/dialogs/Dialog.qml:344:18: QML ScrollView: Binding loop detected for property "calculatedImplicitHeight": qrc:/qt/qml/org/kde/kirigami/dialogs/Dialog.qml:361:9 qrc:/qt/qml/org/kde/kirigami/dialogs/Dialog.qml:401:33: QML Binding: Binding loop detected for property "value": qrc:/qt/qml/org/kde/kirigami/dialogs/Dialog.qml:409:13 Thread 1 "neochat" received signal SIGSEGV, Segmentation fault. 0x00007ffff4e2be15 in QString::append(QString const&) () from /usr/lib/libQt6Core.so.6 ``` gdb backtrace: ``` #0 0x00007ffff4e2be15 in QString::append(QString const&) () at /usr/lib/libQt6Core.so.6 #1 0x00007ffff6bbfe16 in Quotient::Database::database() const () at /usr/lib/libQuotientQt6.so.0.9 #2 0x00007ffff6bc1479 in Quotient::Database::prepareQuery(QString const&) const () at /usr/lib/libQuotientQt6.so.0.9 #3 0x00007ffff6afe020 in Quotient::Connection::isKnownE2eeCapableDevice(QString const&, QString const&) const () at /usr/lib/libQuotientQt6.so.0.9 #4 0x000055555590af77 in DevicesModel::data (this=this@entry=0x555557f18ca0, index=..., role=role@entry=5) at /usr/src/debug/neochat-git/neochat/src/models/devicesmodel.cpp:78 #5 0x0000555555913fb6 in DevicesProxyModel::filterAcceptsRow (this=0x555557f24710, source_row=<optimized out>, source_parent=<optimized out>) at /usr/src/debug/neochat-git/neochat/src/models/devicesproxymodel.cpp:20 #6 0x00007ffff4f80a08 in ??? () at /usr/lib/libQt6Core.so.6 #7 0x00007ffff4f82547 in ??? () at /usr/lib/libQt6Core.so.6 #8 0x00007ffff4f8a54e in QSortFilterProxyModel::rowCount(QModelIndex const&) const () at /usr/lib/libQt6Core.so.6 #9 0x00007ffff2795ce1 in ??? () at /usr/lib/libQt6QmlModels.so.6 #10 0x00007ffff27998e5 in QQmlAdaptorModel::rowCount() const () at /usr/lib/libQt6QmlModels.so.6 #11 0x00007ffff27b1ae4 in QQmlDelegateModel::handleModelReset() () at /usr/lib/libQt6QmlModels.so.6 #12 0x00007ffff4dadd9a in ??? () at /usr/lib/libQt6Core.so.6 #13 0x00007ffff4f58585 in QAbstractItemModel::endResetModel() () at /usr/lib/libQt6Core.so.6 #14 0x00007ffff4f8d3d6 in ??? () at /usr/lib/libQt6Core.so.6 #15 0x00007ffff4dadd9a in ??? () at /usr/lib/libQt6Core.so.6 #16 0x00007ffff4f58585 in QAbstractItemModel::endResetModel() () at /usr/lib/libQt6Core.so.6 #17 0x000055555590f018 in operator() (__closure=<optimized out>) at /usr/src/debug/neochat-git/neochat/src/models/devicesmodel.cpp:41 #18 operator() (__closure=<optimized out>) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:141 #19 QtPrivate::FunctorCallBase::call_internal<void, QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, DevicesModel::fetchDevices()::<lambda()> >::call(DevicesModel::fetchDevices()::<lambda()>&, void**)::<lambda()> > (args=<optimized out>, fn=<optimized out>) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:65 #20 QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, DevicesModel::fetchDevices()::<lambda()> >::call (f=<optimized out>, arg=<optimized out>) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:140 #21 QtPrivate::FunctorCallable<DevicesModel::fetchDevices()::<lambda()> >::call<QtPrivate::List<>, void> (f=<optimized out>, arg=<optimized out>) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:362 #22 QtPrivate::QCallableObject<DevicesModel::fetchDevices()::<lambda()>, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=<optimized out>, this_=<optimized out>, r=<optimized out>, a=<optimized out>, ret=<optimized out>) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:572 #23 0x00007ffff4dadd9a in ??? () at /usr/lib/libQt6Core.so.6 #24 0x00007ffff6aca6e7 in Quotient::BaseJob::success(Quotient::BaseJob*) () at /usr/lib/libQuotientQt6.so.0.9 #25 0x00007ffff6bbd80e in Quotient::BaseJob::finishJob() () at /usr/lib/libQuotientQt6.so.0.9 #26 0x00007ffff4dadd9a in ??? () at /usr/lib/libQt6Core.so.6 #27 0x00007ffff4d9f5b7 in QObject::event(QEvent*) () at /usr/lib/libQt6Core.so.6 #28 0x00007ffff5efe0b7 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt6Widgets.so.6 #29 0x00007ffff4d55f08 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt6Core.so.6 #30 0x00007ffff4d5697c in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /usr/lib/libQt6Core.so.6 #31 0x00007ffff4fb3f54 in ??? () at /usr/lib/libQt6Core.so.6 #32 0x00007ffff1d0aeb9 in ??? () at /usr/lib/libglib-2.0.so.0 #33 0x00007ffff1d6b5d7 in ??? () at /usr/lib/libglib-2.0.so.0 #34 0x00007ffff1d0a432 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0 #35 0x00007ffff4fb1358 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt6Core.so.6 #36 0x00007ffff4d61a55 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt6Core.so.6 #37 0x00007ffff4d5723a in QCoreApplication::exec() () at /usr/lib/libQt6Core.so.6 #38 0x00005555555d73b6 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/neochat-git/neochat/src/main.cpp:307 ``` And now I also once got a crash just after startup and login: Terminal output: ``` [...] Save the access token to the keychain for "@<censored>:<censored>" Could not save access token to the keychain: The name org.freedesktop.secrets was not provided by any .service files quotient.main: CS API versions: r0.0.1 r0.1.0 r0.2.0 r0.3.0 r0.4.0 r0.5.0 r0.6.0 r0.6.1 v1.1 v1.2 v1.3 v1.4 v1.5 v1.6 v1.7 v1.8 v1.9 v1.10 v1.11 quotient.main: Room versions: "10" is default, full list: QList("1"/"stable", "2"/"stable", "3"/"stable", "4"/"stable", "5"/"stable", "6"/"stable", "7"/"stable", "8"/"stable", "9"/"stable", "10"/"stable", "11"/"stable", "org.matrix.msc3757.10"/"unstable", "org.matrix.msc3757.11"/"unstable") quotient.jobs.sync: "SyncJob-1" status Timeout: The job has timed out quotient.jobs.sync: "SyncJob-1" stopped without ready network reply quotient.jobs.sync: "SyncJob-1": retry #1 in 0 s Segmentation fault ``` Regards! The crash happens in libQuotient code (https://github.com/quotient-im/libQuotient) and should be reported there, I don't think NeoChat is doing anything special. Before you report it upstream though, you need to somehow get debug symbols for libQuotient and not just NeoChat, otherwise who knows where in the database it's crashing at. (In reply to Joshua Goins from comment #3) > The crash happens in libQuotient code (https://github.com/quotient-im/libQuotient) and should be reported there Report to libQuotient is there: https://github.com/quotient-im/libQuotient/issues/828 (In reply to Joshua Goins from comment #3) > The crash happens in libQuotient code (https://github.com/quotient-im/libQuotient) and should be reported there, They write back [1]: > I have looked at this at some point and it looks like the database isn't initialized for some reason. FWIW, all of this code is going away / changing entirely soon, so there's not really a point in debugging this further (I don't know if that means if it is the duty of NeoChat to initialise the database and/ or adapt to "all of this code is going away / changing entirely soon", or if this is within libQuotient. For this, I reopen now, and please someone with expertise judge and maybe close again if it is referring to libQuotient-only stuff.) [1] https://github.com/quotient-im/libQuotient/issues/828#issuecomment-2468866408 I have written that; there's nothing for NeoChat to do since the problem is on libQuotient's side (In reply to Tobias Fella from comment #6) > I have written that; there's nothing for NeoChat to do since the problem is on libQuotient's side People at libQuotient tell otherwise [1]: > Actually, I'm not really sure it's libQuotient's fault, now that I looked at the code. Looks like NeoChat tries to call an E2EE-related method without checking if E2EE is even enabled on an account, or before it's enabled. Can you please step in there and discuss? I do not understand the code. [1] https://github.com/quotient-im/libQuotient/issues/828#issuecomment-2468934964 As I wrote in the libQuotient issue tracker, the situation is a bit unconventional here. What is not written in the bug description is that NeoChat is running outside of KDE; moreover, outside of a full desktop environment. One of the terminal outputs has the crucial piece: Could not save access token to the keychain: The name org.freedesktop.secrets was not provided by any .service files which leads me to believe that Qt Keychain couldn't find anything to work with for a keychain, and the library disables E2EE in that situation, to protect the user against data loss. Calling any E2EE-related method like Connection::isKnownE2eeCapableDevice() would then lead to a crash because of the missing E2EE backend. I would strongly recommend checking Connection::encryptionEnabled() on the client side after Connection::connected() or Connection::ready() are emitted; if it does not return true, displaying a message to the user to the effect of "Oh noes, I cannot encrypt anything!!!" and possibly disabling access to the account altogether. It could be argued that checking for Qt Keychain configuration sanity could be done much earlier, even before logging in, then the message could be displayed at the moment of saving/reading the access token. I'm open to discuss possible extension to the library code in this regard - the current access token saving/reading code doesn't handle keychain errors. NeoChat code will still have to be changed in that case, too. > I would strongly recommend checking Connection::encryptionEnabled() on the client side after Connection::connected() or Connection::ready() are emitted
This seems sensible and easy to do, I'll look into adding guards around that. I didn't know that it was possible to libQuotient to turn E2EE off in that situation, I had assumed it's always on (assuming it's built with it)
Yeah, it’s a bit weird failure mode, mainly a remnant from the time when E2EE might be compiled out. It might make sense to completely disable ability to login if a keychain is not accessible, these days, by emitting `Connection::loginError()` with a sensible error message. Now that I think of it, it’s even API/ABI compatible, so probably instead of changing NeoChat it does make sense to change the library instead. Got similar crashes on Haiku, now with sources pulled from 24.12 branch, haven't run it over debugger (yet), but wanting to save my findings here also for now. Created attachment 175861 [details]
Terminal output and syslog event on one of the crashes on Haiku
(In reply to Schrijvers Luc from comment #11) > Got similar crashes on Haiku, now with sources pulled from 24.12 branch, > haven't run it over debugger (yet), but wanting to save my findings here > also for now. With the same preconditions? i.E. when going to "Settings" -> "Devices" when no local keychain provider is available via DBUS? (In reply to dreieck from comment #13) > (In reply to Schrijvers Luc from comment #11) > > Got similar crashes on Haiku, now with sources pulled from 24.12 branch, > > haven't run it over debugger (yet), but wanting to save my findings here > > also for now. > > With the same preconditions? > > i.E. when going to "Settings" -> "Devices" when no local keychain provider > is available via DBUS? Not sure there, qtkeychain takes care of most things for the account I guess, dbus shouldn't be involved in Haiku. |