Bug 477393

Summary: DigiKam crash after moving photos to different directory under its control and *then* wrote metadata to files.
Product: [Applications] digikam Reporter: Roke Julian Lockhart Beedell <4wy78uwh>
Component: Maintenance-DatabaseAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: 4wy78uwh, metzpinguin
Priority: NOR Keywords: drkonqi
Version First Reported In: 8.1.0Flags: 4wy78uwh: performance-
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 8.2.0
Sentry Crash Report:
Attachments: KCrash file.
New crash information added by DrKonqi

Description Roke Julian Lockhart Beedell 2023-11-22 23:31:02 UTC
Application: digikam (8.1.0)

Qt Version: 5.15.11
Frameworks Version: 5.112.0
Operating System: Linux 6.6.1-1-default x86_64
Windowing System: X11
Distribution: "openSUSE Tumbleweed"
DrKonqi: 5.27.9 [KCrashBackend]

-- Information about the crash:
DigiKam crashed after I moved some photos to a different directory under its control and *then* wrote metadata to files.

The reporter is unsure if this crash is reproducible.

-- Backtrace:
Application: digiKam (digikam), signal: Segmentation fault

[KCrash Handler]
#4  0x00007fe89338271d in __memmove_avx512_unaligned_erms () at /lib64/libc.so.6
#5  0x00007fe893b85ed4 in memcpy (__len=65488, __src=<optimized out>, __dest=<optimized out>) at /usr/include/bits/string_fortified.h:29
#6  QString::reallocData(unsigned int, bool) (this=this@entry=0x7fff3b7c5878, alloc=<optimized out>, grow=grow@entry=true) at text/qstring.cpp:2373
#7  0x00007fe893b86685 in QString::append(QChar) (this=this@entry=0x7fff3b7c5878, ch=ch@entry=...) at text/qstring.cpp:2773
#8  0x00007fe896427439 in Digikam::AlbumHistory::getBackwardHistory(QStringList&) const (list=..., this=0x55f5023aee80) at /usr/src/debug/digikam-8.1.0/core/libs/album/engine/albumhistory.cpp:375
#9  Digikam::ItemIconView::getBackwardHistory(QStringList&) (titles=..., this=<optimized out>) at /usr/src/debug/digikam-8.1.0/core/app/views/stack/itemiconview_albums.cpp:481
#10 Digikam::DigikamApp::slotAboutToShowBackwardMenu() (this=0x55f4fdaab2b0) at /usr/src/debug/digikam-8.1.0/core/app/main/digikamapp.cpp:465
#11 0x00007fe893d253e3 in doActivate<false>(QObject*, int, void**) (sender=0x55f5023dfbf0, signal_index=7, argv=0x7fff3b7c5960) at kernel/qobject.cpp:3937
#12 0x00007fe893d1e0af in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (sender=sender@entry=0x55f5023dfbf0, m=m@entry=0x7fe894ec7be0 <QMenu::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x0) at kernel/qobject.cpp:3985
#13 0x00007fe894b24250 in QMenu::aboutToShow() (this=this@entry=0x55f5023dfbf0) at .moc/moc_qmenu.cpp:270
#14 0x00007fe894b29d4e in QMenuPrivate::popup(QPoint const&, QAction*, std::function<QPoint (QSize const&)>) (this=0x55f5023dfc30, p=..., atAction=atAction@entry=0x0, positionFunction=...) at widgets/qmenu.cpp:2409
#15 0x00007fe894b2abae in QMenu::popup(QPoint const&, QAction*) (this=<optimized out>, p=..., atAction=atAction@entry=0x0) at widgets/qmenu.cpp:2353
#16 0x00007fe894b2bd86 in QMenu::internalDelayedPopup() (this=0x55f5027bc300) at widgets/qmenu.cpp:3675
#17 0x00007fe893d18e5b in QObject::event(QEvent*) (this=0x55f5027bc300, e=0x7fff3b7c5c70) at kernel/qobject.cpp:1369
#18 0x00007fe8949a519e in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=<optimized out>, receiver=0x55f5027bc300, e=0x7fff3b7c5c70) at kernel/qapplication.cpp:3640
#19 0x00007fe893ced198 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x55f5027bc300, event=0x7fff3b7c5c70) at kernel/qcoreapplication.cpp:1064
#20 0x00007fe893ced35e in QCoreApplication::sendEvent(QObject*, QEvent*) (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1462
#21 0x00007fe893d454c9 in QTimerInfoList::activateTimers() (this=0x55f4fd6222e0) at kernel/qtimerinfo_unix.cpp:643
#22 0x00007fe893d45d74 in timerSourceDispatch(GSource*, GSourceFunc, gpointer) (source=<optimized out>) at kernel/qeventdispatcher_glib.cpp:183
#23 0x00007fe885866f30 in  () at /lib64/libglib-2.0.so.0
#24 0x00007fe885868b58 in  () at /lib64/libglib-2.0.so.0
#25 0x00007fe88586920c in g_main_context_iteration () at /lib64/libglib-2.0.so.0
#26 0x00007fe893d460d6 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x55f4fd6223b0, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#27 0x00007fe893cebc2b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7fff3b7c5eb0, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#28 0x00007fe893cf40c0 in QCoreApplication::exec() () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#29 0x000055f4fc76aa37 in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/digikam-8.1.0/core/app/main/main.cpp:478
[Inferior 1 (process 20628) detached]

Reported using DrKonqi
Comment 1 Roke Julian Lockhart Beedell 2023-11-22 23:32:28 UTC
Created attachment 163378 [details]
KCrash file.

Application: digiKam (digikam), signal: Segmentation fault

[KCrash Handler]
#4  0x00007fe89338271d in __memmove_avx512_unaligned_erms () at /lib64/libc.so.6
#5  0x00007fe893b85ed4 in memcpy (__len=65488, __src=<optimized out>, __dest=<optimized out>) at /usr/include/bits/string_fortified.h:29
#6  QString::reallocData(unsigned int, bool) (this=this@entry=0x7fff3b7c5878, alloc=<optimized out>, grow=grow@entry=true) at text/qstring.cpp:2373
#7  0x00007fe893b86685 in QString::append(QChar) (this=this@entry=0x7fff3b7c5878, ch=ch@entry=...) at text/qstring.cpp:2773
#8  0x00007fe896427439 in Digikam::AlbumHistory::getBackwardHistory(QStringList&) const (list=..., this=0x55f5023aee80) at /usr/src/debug/digikam-8.1.0/core/libs/album/engine/albumhistory.cpp:375
#9  Digikam::ItemIconView::getBackwardHistory(QStringList&) (titles=..., this=<optimized out>) at /usr/src/debug/digikam-8.1.0/core/app/views/stack/itemiconview_albums.cpp:481
#10 Digikam::DigikamApp::slotAboutToShowBackwardMenu() (this=0x55f4fdaab2b0) at /usr/src/debug/digikam-8.1.0/core/app/main/digikamapp.cpp:465
#11 0x00007fe893d253e3 in doActivate<false>(QObject*, int, void**) (sender=0x55f5023dfbf0, signal_index=7, argv=0x7fff3b7c5960) at kernel/qobject.cpp:3937
#12 0x00007fe893d1e0af in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (sender=sender@entry=0x55f5023dfbf0, m=m@entry=0x7fe894ec7be0 <QMenu::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x0) at kernel/qobject.cpp:3985
#13 0x00007fe894b24250 in QMenu::aboutToShow() (this=this@entry=0x55f5023dfbf0) at .moc/moc_qmenu.cpp:270
#14 0x00007fe894b29d4e in QMenuPrivate::popup(QPoint const&, QAction*, std::function<QPoint (QSize const&)>) (this=0x55f5023dfc30, p=..., atAction=atAction@entry=0x0, positionFunction=...) at widgets/qmenu.cpp:2409
#15 0x00007fe894b2abae in QMenu::popup(QPoint const&, QAction*) (this=<optimized out>, p=..., atAction=atAction@entry=0x0) at widgets/qmenu.cpp:2353
#16 0x00007fe894b2bd86 in QMenu::internalDelayedPopup() (this=0x55f5027bc300) at widgets/qmenu.cpp:3675
#17 0x00007fe893d18e5b in QObject::event(QEvent*) (this=0x55f5027bc300, e=0x7fff3b7c5c70) at kernel/qobject.cpp:1369
#18 0x00007fe8949a519e in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=<optimized out>, receiver=0x55f5027bc300, e=0x7fff3b7c5c70) at kernel/qapplication.cpp:3640
#19 0x00007fe893ced198 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x55f5027bc300, event=0x7fff3b7c5c70) at kernel/qcoreapplication.cpp:1064
#20 0x00007fe893ced35e in QCoreApplication::sendEvent(QObject*, QEvent*) (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1462
#21 0x00007fe893d454c9 in QTimerInfoList::activateTimers() (this=0x55f4fd6222e0) at kernel/qtimerinfo_unix.cpp:643
#22 0x00007fe893d45d74 in timerSourceDispatch(GSource*, GSourceFunc, gpointer) (source=<optimized out>) at kernel/qeventdispatcher_glib.cpp:183
#23 0x00007fe885866f30 in  () at /lib64/libglib-2.0.so.0
#24 0x00007fe885868b58 in  () at /lib64/libglib-2.0.so.0
#25 0x00007fe88586920c in g_main_context_iteration () at /lib64/libglib-2.0.so.0
#26 0x00007fe893d460d6 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x55f4fd6223b0, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#27 0x00007fe893cebc2b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7fff3b7c5eb0, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#28 0x00007fe893cf40c0 in QCoreApplication::exec() () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#29 0x000055f4fc76aa37 in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/digikam-8.1.0/core/app/main/main.cpp:478
[Inferior 1 (process 20628) detached]
Comment 2 Roke Julian Lockhart Beedell 2023-11-22 23:56:24 UTC
Created attachment 163379 [details]
New crash information added by DrKonqi

digikam (8.1.0) using Qt 5.15.11

Somehow DigiKam crashed in the background after it crashed (per https://bugs.kde.org/show_bug.cgi?id=477393) and didn't appear to be launched anymore.

-- Backtrace (Reduced):
#5  0x00007fe893b85ed4 in memcpy (__len=65488, __src=<optimized out>, __dest=<optimized out>) at /usr/include/bits/string_fortified.h:29
#6  QString::reallocData(unsigned int, bool) (this=this@entry=0x7fff3b7c5878, alloc=<optimized out>, grow=grow@entry=true) at text/qstring.cpp:2373
#7  0x00007fe893b86685 in QString::append(QChar) (this=this@entry=0x7fff3b7c5878, ch=ch@entry=...) at text/qstring.cpp:2773
#8  0x00007fe896427439 in Digikam::AlbumHistory::getBackwardHistory(QStringList&) const (list=..., this=0x55f5023aee80) at /usr/src/debug/digikam-8.1.0/core/libs/album/engine/albumhistory.cpp:375
#9  Digikam::ItemIconView::getBackwardHistory(QStringList&) (titles=..., this=<optimized out>) at /usr/src/debug/digikam-8.1.0/core/app/views/stack/itemiconview_albums.cpp:481
Comment 3 Maik Qualmann 2023-11-23 11:01:40 UTC
The crash is clear, but it occurs when you open the Album History menu. We need to protect the Album History QList with a QMutex.

Maik
Comment 4 Roke Julian Lockhart Beedell 2023-11-23 16:11:48 UTC
(In reply to Maik Qualmann from comment #3)
> The crash is clear, but it occurs when you open the Album History menu. We
> need to protect the Album History QList with a QMutex.
> 
> Maik

Strange. It definitely crashed in the background - it wasn't open.
Comment 5 Maik Qualmann 2023-11-26 12:04:24 UTC
Git commit 8ab925e24dda65a36c8a6b35bf4877eedb2cad08 by Maik Qualmann.
Committed on 26/11/2023 at 13:03.
Pushed by mqualmann into branch 'master'.

protect the AlbumHistory class with a QMutex
FIXED-IN: 8.2.0

M  +1    -1    NEWS
M  +23   -0    core/libs/album/engine/albumhistory.cpp

https://invent.kde.org/graphics/digikam/-/commit/8ab925e24dda65a36c8a6b35bf4877eedb2cad08