Bug 422502 - Core dumped (Assert failed QList index out of range)
Summary: Core dumped (Assert failed QList index out of range)
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Albums-Engine (other bugs)
Version First Reported In: 6.4.0
Platform: Arch Linux Linux
: NOR crash
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-05 21:13 UTC by yaogen
Modified: 2020-06-06 13:48 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 7.0.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description yaogen 2020-06-05 21:13:47 UTC
SUMMARY

When moving hundreds of photos from one album to another, repeatedly, after some time I get 
ASSERT failure in QList<T>::at: "index out of range", file /usr/include/qt/QtCore/qlist.h, line 571
(core dumped)


STEPS TO REPRODUCE
1. Have several albums (nested) with hundreds of photos in each
2. Move photos from one album to another, repeatedly
3. Observe Assertion failure

OBSERVED RESULT

Core dumped, assertion failure.

Also, a number of photos was moved but upon restarting, the database isn't updated and still believes the photos are in the old location. A refresh will fix this. Luckily it seems that no photos are lost.
I've also observed that some photos was moved and not removed from the old location so that duplicates was accidentally created. (Still better than loosing them completely though)

EXPECTED RESULT

Well, not crashing :-)

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 5.6.8-arch1-1, digikam 6.4.0-9
(available in About System)
KDE Plasma Version: n/a, running i3wm
KDE Frameworks Version:  n/a, running i3wm
Qt Version: 5.14.2

ADDITIONAL INFORMATION
Comment 1 Maik Qualmann 2020-06-05 21:19:36 UTC
Please give us a GDB backtrace as described here:

https://www.digikam.org/contribute/

And test the current digiKam-7.0.0-RC from here:

https://files.kde.org/digikam/

Maik
Comment 2 Maik Qualmann 2020-06-06 05:28:23 UTC
Git commit e0b9868e9774cad1d570d17f538b042453d1fe70 by Maik Qualmann.
Committed on 06/06/2020 at 05:25.
Pushed by mqualmann into branch 'master'.

use recursive QMutex to protect QList
FIXED-IN: 7.0.0

M  +2    -1    NEWS
M  +2    -1    core/libs/iojobs/iojobdata.cpp
M  +2    -1    core/utilities/maintenance/maintenancedata.cpp

https://invent.kde.org/graphics/digikam/commit/e0b9868e9774cad1d570d17f538b042453d1fe70
Comment 3 yaogen 2020-06-06 08:37:16 UTC
Reported this last night and it's solved when I wake up.
Incredible :-)

Would you still need the GDB backtrace or you feel that your fix "was it" ?

Thanks
Comment 4 Maik Qualmann 2020-06-06 08:48:15 UTC
There is actually no other QList than from IOJobData that could accidentally crash. Yes, a backtrace would be nice.

Maik
Comment 5 yaogen 2020-06-06 10:28:09 UTC
After doing 1,2,3 above for a while I got the following out of gdb

[Thread 0x7fff2c915700 (LWP 1266290) exited]
--Type <RET> for more, q to quit, c to continue without paging--
[Switching to Thread 0x7fffd5a88700 (LWP 846207)]

Thread 4 "Digikam::ScanCo" hit Catchpoint 1 (exception thrown), 0x00007ffff4f49062 in __cxxabiv1::__cxa_throw (obj=0x7fffc8470f20, 
    tinfo=0x7ffff7101f40 <typeinfo for Exiv2::BasicError<char>>, dest=0x7ffff10db150) at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_throw.cc:78
78	/build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_throw.cc: No such file or directory.


(gdb) bt
#0  0x00007ffff4f49062 in __cxxabiv1::__cxa_throw(void*, std::type_info*, void (*)(void*))
    (obj=0x7fffc8470f20, tinfo=0x7ffff7101f40 <typeinfo for Exiv2::BasicError<char>>, dest=0x7ffff10db150)
    at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_throw.cc:78
#1  0x00007ffff10a4574 in  () at /usr/lib/libexiv2.so.27
#2  0x00007ffff110e441 in Exiv2::ImageFactory::open(std::auto_ptr<Exiv2::BasicIo>) () at /usr/lib/libexiv2.so.27
#3  0x00007ffff110e534 in Exiv2::ImageFactory::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) ()
    at /usr/lib/libexiv2.so.27
#4  0x00007ffff69d55e4 in Digikam::MetaEngine::load(QString const&) () at /usr/lib/libdigikamcore.so.6.4.0
#5  0x00007ffff6a08897 in Digikam::DMetadata::load(QString const&) () at /usr/lib/libdigikamcore.so.6.4.0
#6  0x00007ffff73042f3 in Digikam::ItemScanner::loadFromDisk() () at /usr/lib/libdigikamdatabase.so.6.4.0
#7  0x00007ffff7308d44 in Digikam::ItemScanner::copiedFrom(int, long long) () at /usr/lib/libdigikamdatabase.so.6.4.0
#8  0x00007ffff723a807 in Digikam::CollectionScanner::scanNewFile(QFileInfo const&, int) () at /usr/lib/libdigikamdatabase.so.6.4.0
#9  0x00007ffff723d530 in Digikam::CollectionScanner::scanAlbum(Digikam::CollectionLocation const&, QString const&) ()
    at /usr/lib/libdigikamdatabase.so.6.4.0
#10 0x00007ffff723f23f in Digikam::CollectionScanner::partialScan(QString const&, QString const&) () at /usr/lib/libdigikamdatabase.so.6.4.0
#11 0x00007ffff723f4d4 in Digikam::CollectionScanner::partialScan(QString const&) () at /usr/lib/libdigikamdatabase.so.6.4.0
#12 0x00007ffff77c7a8a in Digikam::ScanController::run() () at /usr/lib/libdigikamgui.so.6.4.0
#13 0x00007ffff514ddcf in  () at /usr/lib/libQt5Core.so.5
#14 0x00007ffff147d422 in start_thread () at /usr/lib/libpthread.so.0
#15 0x00007ffff4dc2bf3 in clone () at /usr/lib/libc.so.6


Hope this is what you need :-)
Comment 6 Maik Qualmann 2020-06-06 10:44:14 UTC
This is not a crash in a QList. It crashes in Exiv2, possibly due to a broken image. Try to isolate the image that causes the crash when reading the metadata.

We have over 700 closed bugs in digiKam-7.0.0-RC. The QList patch is not yet included in the current AppImage. Please try to reproduce the problem with the AppImage from here:

https://files.kde.org/digikam/

Maik
Comment 7 yaogen 2020-06-06 11:19:29 UTC
Indeed, those are Exiv2 thrown stuff. I only caught those by following the instructions to use 'catch throw'. But after removing that breakpoint and letting the Assertion hit, I got the following:

ASSERT failure in QList<T>::at: "index out of range", file /usr/include/qt/QtCore/qlist.h, line 571
--Type <RET> for more, q to quit, c to continue without paging--

Thread 1 "digikam" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffdddc60c0 (LWP 1352309)]
0x00007ffff4cff355 in raise () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff4cff355 in raise () at /usr/lib/libc.so.6
#1  0x00007ffff4ce8853 in abort () at /usr/lib/libc.so.6
#2  0x00007ffff51119ac in  () at /usr/lib/libQt5Core.so.5
#3  0x00007ffff5110db6 in  () at /usr/lib/libQt5Core.so.5
#4  0x00007ffff72258da in  () at /usr/lib/libdigikamdatabase.so.6.4.0
#5  0x00007ffff72c5711 in Digikam::ItemInfo::imageCommonContainer() const () at /usr/lib/libdigikamdatabase.so.6.4.0
#6  0x00007ffff79b63b6 in Digikam::ItemPropertiesSideBarDB::setImagePropertiesInformation(QUrl const&) () at /usr/lib/libdigikamgui.so.6.4.0
#7  0x00007ffff79b8891 in Digikam::ItemPropertiesSideBarDB::slotChangedTab(QWidget*) () at /usr/lib/libdigikamgui.so.6.4.0
#8  0x00007ffff79b60e4 in Digikam::ItemPropertiesSideBarDB::itemChanged(Digikam::ItemInfoList const&, QRect const&, Digikam::DImg*, Digikam::DImageHistory const&) () at /usr/lib/libdigikamgui.so.6.4.0
#9  0x00007ffff79b61ab in Digikam::ItemPropertiesSideBarDB::itemChanged(Digikam::ItemInfoList const&) () at /usr/lib/libdigikamgui.so.6.4.0
#10 0x00007ffff7970169 in Digikam::ItemIconView::slotDispatchImageSelected() () at /usr/lib/libdigikamgui.so.6.4.0
#11 0x00007ffff78ba283 in  () at /usr/lib/libdigikamgui.so.6.4.0
#12 0x00007ffff5362d90 in  () at /usr/lib/libQt5Core.so.5
#13 0x00007ffff536684b in QTimer::timeout(QTimer::QPrivateSignal) () at /usr/lib/libQt5Core.so.5
#14 0x00007ffff535907f in QObject::event(QEvent*) () at /usr/lib/libQt5Core.so.5
#15 0x00007ffff5dd2652 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#16 0x00007ffff532d2d2 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#17 0x00007ffff5383485 in QTimerInfoList::activateTimers() () at /usr/lib/libQt5Core.so.5
#18 0x00007ffff5383d6a in  () at /usr/lib/libQt5Core.so.5
#19 0x00007fffed9db43c in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#20 0x00007fffeda28fa9 in  () at /usr/lib/libglib-2.0.so.0
#21 0x00007fffed9da221 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#22 0x00007ffff5384101 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#23 0x00007ffff532bc0c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#24 0x00007ffff53340a6 in QCoreApplication::exec() () at /usr/lib/libQt5Core.so.5
#25 0x0000555555559391 in main ()
Comment 8 yaogen 2020-06-06 11:50:12 UTC
Got another crash, slightly different output (and no ASSERT string)
Maybe related, maybe not. *shrug*

Thread 1 "digikam" received signal SIGABRT, Aborted.
0x00007ffff4cff355 in raise () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff4cff355 in raise () at /usr/lib/libc.so.6
#1  0x00007ffff4ce8853 in abort () at /usr/lib/libc.so.6
#2  0x00007ffff51119ac in  () at /usr/lib/libQt5Core.so.5
#3  0x00007ffff5110db6 in  () at /usr/lib/libQt5Core.so.5
#4  0x00007ffff72258da in  () at /usr/lib/libdigikamdatabase.so.6.4.0
#5  0x00007ffff72c5711 in Digikam::ItemInfo::imageCommonContainer() const () at /usr/lib/libdigikamdatabase.so.6.4.0
#6  0x00007ffff79b63b6 in Digikam::ItemPropertiesSideBarDB::setImagePropertiesInformation(QUrl const&) () at /usr/lib/libdigikamgui.so.6.4.0
#7  0x00007ffff79b8891 in Digikam::ItemPropertiesSideBarDB::slotChangedTab(QWidget*) () at /usr/lib/libdigikamgui.so.6.4.0
#8  0x00007ffff79b83f0 in Digikam::ItemPropertiesSideBarDB::slotImageChangeDatabase(Digikam::ImageChangeset const&) ()
    at /usr/lib/libdigikamgui.so.6.4.0
#9  0x00007ffff79afdb5 in  () at /usr/lib/libdigikamgui.so.6.4.0
#10 0x00007ffff5359142 in QObject::event(QEvent*) () at /usr/lib/libQt5Core.so.5
#11 0x00007ffff5dd2652 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#12 0x00007ffff532d2d2 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#13 0x00007ffff532fce3 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /usr/lib/libQt5Core.so.5
#14 0x00007ffff5384ab4 in  () at /usr/lib/libQt5Core.so.5
#15 0x00007fffed9db43c in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#16 0x00007fffeda28fa9 in  () at /usr/lib/libglib-2.0.so.0
#17 0x00007fffed9da221 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#18 0x00007ffff5384101 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#19 0x00007ffff532bc0c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#20 0x00007ffff53340a6 in QCoreApplication::exec() () at /usr/lib/libQt5Core.so.5
#21 0x0000555555559391 in main ()
Comment 9 Maik Qualmann 2020-06-06 13:38:26 UTC
Git commit bbf54d0a181e4deef2b5157bc364e1224af2380f by Maik Qualmann.
Committed on 06/06/2020 at 13:35.
Pushed by mqualmann into branch 'master'.

fix possible crash in ItemScanne::fillCommonContainer()

M  +2    -2    core/libs/database/item/scanner/itemscanner_file.cpp

https://invent.kde.org/graphics/digikam/commit/bbf54d0a181e4deef2b5157bc364e1224af2380f
Comment 10 Maik Qualmann 2020-06-06 13:48:15 UTC
Git commit 7be97f111e72109c359ff32496768b02530f0c7e by Maik Qualmann.
Committed on 06/06/2020 at 13:46.
Pushed by mqualmann into branch 'master'.

The problem of different field sizes in the context of a database error
was already solved for digiKam-7.0.0

M  +4    -2    core/libs/database/item/scanner/itemscanner_file.cpp

https://invent.kde.org/graphics/digikam/commit/7be97f111e72109c359ff32496768b02530f0c7e