Bug 473110

Summary: Assertion failure when new folder is created in album (inside our outside of Digikam)
Product: [Applications] digikam Reporter: tlangner+kde
Component: Albums-EngineAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: caulier.gilles
Priority: NOR    
Version: 8.1.0   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 8.2.0
Sentry Crash Report:

Description tlangner+kde 2023-08-07 13:10:11 UTC
SUMMARY
When I create a new folder inside of an album, either by right-clicking an existing album and choosing "New..." or creating the folder on the filesystem, digikam crashes right after with an assertion failure.

ASSERT: "size == 0 || offset < 0 || size_t(offset) >= sizeof(QArrayData)" in file /usr/include/x86_64-linux-gnu/qt5/QtCore/qarraydata.h, line 59

STEPS TO REPRODUCE
1. Start digikam
2. Create a new album with Ctrl+N and click OK

OBSERVED RESULT
Crash.

EXPECTED RESULT
No crash.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Ubuntu Lunar
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 5.15.8

ADDITIONAL INFORMATION

STACKTRACE

ASSERT: "size == 0 || offset < 0 || size_t(offset) >= sizeof(QArrayData)" in file /usr/include/x86_64-linux-gnu/qt5/QtCore/qarraydata.h, line 59

Thread 1 "digikam" received signal SIGABRT, Aborted.
__pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)
at ./nptl/pthread_kill.c:44
44      ./nptl/pthread_kill.c: No such file or directory.
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)
at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=<optimized out>)
at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
at ./nptl/pthread_kill.c:89
#3  0x00007ffff4c77406 in __GI_raise (sig=sig@entry=6)
at ../sysdeps/posix/raise.c:26
#4  0x00007ffff4c5d87c in __GI_abort () at ./stdlib/abort.c:79
#5  0x00007ffff5162ccf in QMessageLogger::fatal(char const*, ...) const ()
from /lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007ffff5162040 in qt_assert(char const*, char const*, int) ()
from /lib/x86_64-linux-gnu/libQt5Core.so.
#7  0x00007ffff79149cd in ?? () from /usr/lib/digikam/libdigikamgui.so.8.1.0
#8  0x00007ffff7914acd in ?? () from /usr/lib/digikam/libdigikamgui.so.8.1.0
#9  0x00007ffff7ab6619 in Digikam::AbstractAlbumModel::index(int, int, QModelIndex const&) const () from /usr/lib/digikam/libdigikamgui.so.8.1.0
#10 0x00007ffff7ae9ce8 in ?? () from /usr/lib/digikam/libdigikamgui.so.8.1.0
#11 0x00007ffff53c59dc in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#12 0x00007ffff5325a32 in QAbstractItemModel::rowsInserted(QModelIndex const&, int, int, QAbstractItemModel::QPrivateSignal) ()
from /lib/x86_64-linux-gnu/libQt5Core.so.5
#13 0x00007ffff532e3ee in QAbstractItemModel::endInsertRows() ()
--Type <RET> for more, q to quit, c to continue without paging--
from /lib/x86_64-linux-gnu/libQt5Core.so.5
#14 0x00007ffff535a5a5 in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#15 0x00007ffff535dd45 in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#16 0x00007ffff5361f75 in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#17 0x00007ffff53c59dc in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#18 0x00007ffff5325a32 in QAbstractItemModel::rowsInserted(QModelIndex const&, int, int, QAbstractItemModel::QPrivateSignal) ()
from /lib/x86_64-linux-gnu/libQt5Core.so.5
#19 0x00007ffff532e3ee in QAbstractItemModel::endInsertRows() ()
from /lib/x86_64-linux-gnu/libQt5Core.so.5
#20 0x00007ffff7ab5865 in Digikam::AbstractAlbumModel::slotAlbumAdded(Digikam::Album*) () from /usr/lib/digikam/libdigikamgui.so.8.1.0
#21 0x00007ffff53c59af in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#22 0x00007ffff7ac08e6 in Digikam::AlbumManager::signalAlbumAdded(Digikam::Album*) () from /usr/lib/digikam/libdigikamgui.so.8.1.0
#23 0x00007ffff7b0371d in Digikam::AlbumManager::scanPAlbums() ()
from /usr/lib/digikam/libdigikamgui.so.8.1.0
#24 0x00007ffff53c59dc in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#25 0x00007ffff53c998e in QTimer::timeout(QTimer::QPrivateSignal) ()
from /lib/x86_64-linux-gnu/libQt5Core.so.5
#26 0x00007ffff53b9bf5 in QObject::event(QEvent*) ()
from /lib/x86_64-linux-gnu/libQt5Core.so.5
#27 0x00007ffff5e7bf92 in QApplicationPrivate::notify_helper(QObject*, QEvent*)
--Type <RET> for more, q to quit, c to continue without paging--
() from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#28 0x00007ffff538ce38 in QCoreApplication::notifyInternal2(QObject*, QEvent*)
() from /lib/x86_64-linux-gnu/libQt5Core.so.5
#29 0x00007ffff53e6201 in QTimerInfoList::activateTimers() ()
from /lib/x86_64-linux-gnu/libQt5Core.so.5
#30 0x00007ffff53e6aec in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#31 0x00007fffe5ef849d in g_main_context_dispatch ()
from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#32 0x00007fffe5f53178 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#33 0x00007fffe5ef71b0 in g_main_context_iteration ()
from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#34 0x00007ffff53e6e7a in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#35 0x00007ffff538b7cb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#36 0x00007ffff5393c1a in QCoreApplication::exec() ()
from /lib/x86_64-linux-gnu/libQt5Core.so.5
#37 0x000055555555a9a4 in ?? ()
#38 0x00007ffff4c5ea90 in __libc_start_call_main (
main=main@entry=0x555555559800, argc=argc@entry=1,
argv=argv@entry=0x7fffffffec68)
at ../sysdeps/nptl/libc_start_call_main.h:58
#39 0x00007ffff4c5eb49 in __libc_start_main_impl (main=0x555555559800, argc=1,
--Type <RET> for more, q to quit, c to continue without paging--
argv=0x7fffffffec68, init=<optimized out>, fini=<optimized out>,
rtld_fini=<optimized out>, stack_end=0x7fffffffec58)
at ../csu/libc-start.c:360
#40 0x000055555555b4d5 in ?? ()
Comment 1 caulier.gilles 2023-08-07 13:20:02 UTC
If you use a native package, please install the debug symbols to get a full bactrace with GDB.

If you use AppImage bundle, just use the debug version as well.
Comment 2 tlangner+kde 2023-08-07 14:02:50 UTC
Thanks for the swift reply.

I installed digikam 8.1 in Ubuntu Lunar through a backports repository, and from what I can tell installing debug symbols is non-trivial for that. So I tried with the AppImage debug bundle. Naturally, I cannot reproduce the issue with that. Even more interestingly, trying again with the Ubuntu package, the crash no longer happens either... (It has happened more than 20 times since yesterday, which led me to reporting the bug to begin with...)

I'll close the bug for now but will re-open in case the issue re-appears.
Comment 3 Maik Qualmann 2023-08-07 18:06:56 UTC
Git commit dadc355a27d59a2e208adcad954596313081ecf7 by Maik Qualmann.
Committed on 07/08/2023 at 20:06.
Pushed by mqualmann into branch 'master'.

protect the album child cache consistently with a write lock

M  +10   -7    core/libs/album/engine/album.cpp

https://invent.kde.org/graphics/digikam/-/commit/dadc355a27d59a2e208adcad954596313081ecf7
Comment 4 Maik Qualmann 2023-08-27 16:01:24 UTC
Git commit 8a7ee594fbee5a1c1bcd147e5d023802d258af86 by Maik Qualmann.
Committed on 27/08/2023 at 17:58.
Pushed by mqualmann into branch 'master'.

fix crash in album child cache when Qt is build with debugging assertions
Related: bug 473801
FIXED-IN: 8.2.0

M  +2    -1    NEWS
M  +6    -1    core/libs/album/engine/album.cpp

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