Bug 475248

Summary: Crashes when trying to download a file
Product: [Applications] NeoChat Reporter: Nate Graham <nate>
Component: GeneralAssignee: Tobias Fella <fella>
Status: RESOLVED FIXED    
Severity: normal CC: carl, sitter
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=472862
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Nate Graham 2023-10-05 15:08:11 UTC
NeoChat built against Qt6 running on Plasma 6 Wayland

STEPS TO REPRODUCE
1. Have someone attach a file to a message (in this case a 42 Mb LibreOffice Impress presentation)
2. Click the download button

OBSERVED RESULT
The Save dialog briefly appears and then immediately disappears, and NeoChat crashes. The backtrace is the same every time:

Application: NeoChat (neochat), signal: Segmentation fault
Content of s_kcrashErrorMessage: std::unique_ptr<char []> = {get() = 0x0}
[KCrash Handler]
#5  0x00007f25cfd7f56b in __strcmp_avx2 () at /lib64/libc.so.6
#6  0x0000000000575b56 in DebugPrivate::log(QtMsgType, QMessageLogContext const&, QString const&) (this=0x989ce0 <QGlobalStatic<QtGlobalStatic::Holder<(anonymous namespace)::Q_QGS_sInstance> >::instance()::holder>, type=QtCriticalMsg, context=..., message=...) at /home/nate/kde/src/neochat/src/logger.cpp:120
#7  0x00007f25d030c98b in qt_message_output(QtMsgType, QMessageLogContext const&, QString const&) () at /lib64/libQt6Core.so.6
#8  0x00007f25d02d8c29 in qErrnoWarning(char const*, ...) () at /lib64/libQt6Core.so.6
#9  0x00007f25d02fbae7 in QInotifyFileSystemWatcherEngine::addPaths(QList<QString> const&, QList<QString>*, QList<QString>*) [clone .cold] () at /lib64/libQt6Core.so.6
#10 0x00007f25d056070d in QFileSystemWatcher::addPaths(QList<QString> const&) () at /lib64/libQt6Core.so.6
#11 0x00007f25d05616b6 in QFileSystemWatcher::addPath(QString const&) () at /lib64/libQt6Core.so.6
#12 0x00007f25d20de52b in KDirWatchPrivate::useQFSWatch(KDirWatchPrivate::Entry*) (this=this@entry=0x749c870, e=e@entry=0x78fcaf8) at /home/nate/kde/src/kcoreaddons/src/lib/io/kdirwatch.cpp:781
#13 0x00007f25d20de753 in KDirWatchPrivate::addWatch(KDirWatchPrivate::Entry*) (this=0x749c870, e=0x78fcaf8) at /home/nate/kde/src/kcoreaddons/src/lib/io/kdirwatch.cpp:1029
#14 0x00007f25d20dcd54 in KDirWatchPrivate::addEntry(KDirWatch*, QString const&, KDirWatchPrivate::Entry*, bool, QFlags<KDirWatch::WatchMode>) (this=0x749c870, instance=0x7f25d2147e10 <QGlobalStatic<QtGlobalStatic::Holder<(anonymous namespace)::Q_QGS_s_pKDirWatchSelf> >::instance()::holder>, _path=<optimized out>, sub_entry=sub_entry@entry=0x0, isDir=isDir@entry=true, watchModes=...) at /home/nate/kde/src/kcoreaddons/src/lib/io/kdirwatch.cpp:958
#15 0x00007f25d20de849 in KDirWatch::addDir(QString const&, QFlags<KDirWatch::WatchMode>) (this=<optimized out>, _path=<optimized out>, watchModes=...) at /home/nate/kde/src/kcoreaddons/src/lib/io/kdirwatch.cpp:1908
#16 0x00007f25d2500a95 in KSambaShare::KSambaShare() (this=0x7f25d263e000 <QGlobalStatic<QtGlobalStatic::Holder<(anonymous namespace)::Q_QGS__instance> >::instance()::holder>) at /usr/include/qt6/QtCore/qflags.h:74
#17 0x00007f25d2500b86 in KSambaShareSingleton::KSambaShareSingleton() (this=0x7f25d263e000 <QGlobalStatic<QtGlobalStatic::Holder<(anonymous namespace)::Q_QGS__instance> >::instance()::holder>) at /home/nate/kde/src/kio/src/core/ksambashare.cpp:523
#18 (anonymous namespace)::Q_QGS__instance::innerFunction (pointer=0x7f25d263e000 <QGlobalStatic<QtGlobalStatic::Holder<(anonymous namespace)::Q_QGS__instance> >::instance()::holder>) at /home/nate/kde/src/kio/src/core/ksambashare.cpp:529
#19 QtGlobalStatic::Holder<(anonymous namespace)::Q_QGS__instance>::Holder (this=0x7f25d263e000 <QGlobalStatic<QtGlobalStatic::Holder<(anonymous namespace)::Q_QGS__instance> >::instance()::holder>) at /usr/include/qt6/QtCore/qglobalstatic.h:37
#20 QGlobalStatic<QtGlobalStatic::Holder<(anonymous namespace)::Q_QGS__instance> >::instance () at /usr/include/qt6/QtCore/qglobalstatic.h:91
#21 QGlobalStatic<QtGlobalStatic::Holder<(anonymous namespace)::Q_QGS__instance> >::operator() (this=<optimized out>) at /usr/include/qt6/QtCore/qglobalstatic.h:73
#22 KSambaShare::instance() () at /home/nate/kde/src/kio/src/core/ksambashare.cpp:533
#23 0x00007f25d250be6d in KFileItem::overlays() const (this=this@entry=0x7797678) at /home/nate/kde/src/kio/src/core/kfileitem.cpp:1184
#24 0x00007f25d2bb7600 in KDirModel::data(QModelIndex const&, int) const (this=<optimized out>, index=<optimized out>, role=<optimized out>) at /home/nate/kde/src/kio/src/widgets/kdirmodel.cpp:876
#25 0x00007f25d05eda19 in QSortFilterProxyModel::data(QModelIndex const&, int) const () at /lib64/libQt6Core.so.6
#26 0x00007f25d2ba0c88 in QModelIndex::data(int) const (arole=1, this=0x7fffac616680) at /usr/include/qt6/QtCore/qabstractitemmodel.h:493
#27 KFileItemDelegate::Private::decoration(QStyleOptionViewItem const&, QModelIndex const&) const (this=this@entry=0x7806480, option=..., index=...) at /home/nate/kde/src/kio/src/widgets/kfileitemdelegate.cpp:999
#28 0x00007f25d2ba13cc in KFileItemDelegate::Private::initStyleOption(QStyleOptionViewItem*, QModelIndex const&) const (this=0x7806480, option=option@entry=0x7fffac616680, index=...) at /home/nate/kde/src/kio/src/widgets/kfileitemdelegate.cpp:762
#29 0x00007f25d2ba1a05 in KFileItemDelegate::sizeHint(QStyleOptionViewItem const&, QModelIndex const&) const (this=0x3c67ff0, option=..., index=...) at /usr/include/c++/13/bits/unique_ptr.h:199
#30 0x00007f25d1928a65 in QTreeView::indexRowSizeHint(QModelIndex const&) const () at /lib64/libQt6Widgets.so.6
#31 0x00007f25d1931179 in QTreeViewPrivate::layout(int, bool, bool) () at /lib64/libQt6Widgets.so.6
#32 0x00007f25d1936fa1 in QTreeView::doItemsLayout() () at /lib64/libQt6Widgets.so.6
#33 0x00007f25d192b839 in QTreeView::visualRect(QModelIndex const&) const () at /lib64/libQt6Widgets.so.6
#34 0x00007f25bdf8dff4 in KFilePreviewGeneratorPrivate::orderItems(KFileItemList&) (this=this@entry=0x78371e0, items=...) at /home/nate/kde/src/kio/src/filewidgets/kfilepreviewgenerator.cpp:1055
#35 0x00007f25bdf8fb19 in KFilePreviewGeneratorPrivate::updateIcons(KFileItemList const&) (this=0x78371e0, items=...) at /home/nate/kde/src/kio/src/filewidgets/kfilepreviewgenerator.cpp:513
#36 0x00007f25d03de3a4 in void doActivate<false>(QObject*, int, void**) () at /lib64/libQt6Core.so.6
#37 0x00007f25d259c0e5 in KCoreDirLister::newItems(KFileItemList const&) (this=<optimized out>, _t1=...) at /home/nate/kde/build6/kio/src/core/KF6KIOCore_autogen/include/moc_kcoredirlister.cpp:673
#38 0x00007f25d25a1ddd in KCoreDirListerPrivate::emitItems() (this=0x7583a60) at /home/nate/kde/src/kio/src/core/kcoredirlister.cpp:2487
#39 0x00007f25d25b3d51 in KCoreDirListerCache::slotEntries(KIO::Job*, QList<KIO::UDSEntry> const&) (this=0x74a2270, job=<optimized out>, entries=<optimized out>) at /home/nate/kde/src/kio/src/core/kcoredirlister.cpp:1238
#40 0x00007f25d03de3a4 in void doActivate<false>(QObject*, int, void**) () at /lib64/libQt6Core.so.6
#41 0x00007f25d2559434 in KIO::ListJob::entries(KIO::Job*, QList<KIO::UDSEntry> const&) (this=<optimized out>, _t1=<optimized out>, _t2=<optimized out>) at /home/nate/kde/build6/kio/src/core/KF6KIOCore_autogen/include/moc_listjob.cpp:320
#42 0x00007f25d03de3a4 in void doActivate<false>(QObject*, int, void**) () at /lib64/libQt6Core.so.6
#43 0x00007f25d25d007d in KIO::WorkerInterface::listEntries(QList<KIO::UDSEntry> const&) (_t1=..., this=0x4dd04c0) at /home/nate/kde/build6/kio/src/core/KF6KIOCore_autogen/include/moc_workerinterface_p.cpp:653
#44 KIO::WorkerInterface::dispatch(int, QByteArray const&) (this=0x4dd04c0, _cmd=<optimized out>, rawdata=<optimized out>) at /home/nate/kde/src/kio/src/core/workerinterface.cpp:146
#45 0x00007f25d25cdbca in KIO::WorkerInterface::dispatch() (this=0x4dd04c0) at /home/nate/kde/src/kio/src/core/workerinterface.cpp:60
#46 0x00007f25d25caf0a in KIO::Worker::gotInput() (this=0x4dd04c0) at /home/nate/kde/src/kio/src/core/worker.cpp:263
#47 0x00007f25d03de3a4 in void doActivate<false>(QObject*, int, void**) () at /lib64/libQt6Core.so.6
#48 0x00007f25d03cfe67 in QObject::event(QEvent*) () at /lib64/libQt6Core.so.6
#49 0x00007f25d15c0af8 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib64/libQt6Widgets.so.6
#50 0x00007f25d037cdc8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib64/libQt6Core.so.6
#51 0x00007f25d03808e5 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /lib64/libQt6Core.so.6
#52 0x00007f25d062106f in postEventSourceDispatch(_GSource*, int (*)(void*), void*) () at /lib64/libQt6Core.so.6
#53 0x00007f25cdd134fc in g_main_context_dispatch () at /lib64/libglib-2.0.so.0
#54 0x00007f25cdd716b8 in g_main_context_iterate.isra () at /lib64/libglib-2.0.so.0
#55 0x00007f25cdd10b83 in g_main_context_iteration () at /lib64/libglib-2.0.so.0
#56 0x00007f25d062090f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt6Core.so.6
#57 0x00007f25d0389a03 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt6Core.so.6
#58 0x00007f25d03856ad in QCoreApplication::exec() () at /lib64/libQt6Core.so.6
#59 0x0000000000433a1b in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at /home/nate/kde/src/neochat/src/main.cpp:252
[Inferior 1 (process 324503) detached]


This might be related to Bug 472862, which is also a crash in KDirWatch that I experience, but that one is not consistently reproducible the way this crash is.
Comment 1 Nate Graham 2023-10-05 15:30:05 UTC
Just found this in my Journal log. Maybe related?

Oct 05 09:28:47 Liberator plasmashell[338385]: inotify_add_watch(/var/lib/samba/usershares) failed: (Permission denied)
Comment 2 Harald Sitter 2023-10-05 16:37:34 UTC
I believe what's going on here is that in logger.cpp the context.category is nullptr and strcmp is explicitly expecting nonnull. IOW there needs a nullptr check somewhere.
Comment 3 Bug Janitor Service 2023-10-27 20:02:25 UTC
A possibly relevant merge request was started @ https://invent.kde.org/network/neochat/-/merge_requests/1370
Comment 4 Tobias Fella 2023-10-28 09:16:26 UTC
Git commit 2c6932b4cb5ace5906b6771ecf83a7af1380c449 by Tobias Fella.
Committed on 28/10/2023 at 11:12.
Pushed by tfella into branch 'master'.

Fix crash when there is an empty logging category

M  +1    -1    src/logger.cpp

https://invent.kde.org/network/neochat/-/commit/2c6932b4cb5ace5906b6771ecf83a7af1380c449