Bug 324774

Summary: Adding tag or deleting tag in "unknown" folder causes crash.
Product: digikam Reporter: Mike Booth <mikebooth76>
Component: Faces-EngineAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: caulier.gilles
Priority: NOR    
Version: 3.4.0   
Target Milestone: ---   
Platform: Slackware Packages   
OS: Linux   
Latest Commit: Version Fixed In: 5.1.0

Description Mike Booth 2013-09-10 23:35:18 UTC
After adding or deleting tag to faces in "unknown" folder I can see memory usage at 1546624K. I have 4Gb available.then digikam crashes.

Application: digikam (3.4.0)
KDE Platform Version: 4.11.1
Qt Version: 4.8.5
Operating System: Linux 3.11.0 i686
Distribution (Platform): Slackware Packages

-- Information about the crash:
<In detail, tell us what you were doing  when the application crashed.>

The crash can be reproduced every time.

-- Backtrace:
Application: digiKam (digikam), signal: Aborted
Using host libthread_db library "/lib/libthread_db.so.1".
[Current thread is 1 (Thread 0xac3e1880 (LWP 6213))]

Thread 7 (Thread 0xab3bfb40 (LWP 6222)):
#0  0xb38986f1 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#1  0xb3918615 in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/qt/lib/libQtCore.so.4
#2  0x08208b02 in ?? ()
#3  0xb391809f in ?? () from /usr/lib/qt/lib/libQtCore.so.4
#4  0xb3894955 in start_thread () from /lib/libpthread.so.0
#5  0xb353af8e in clone () from /lib/libc.so.6

Thread 6 (Thread 0xaa9ffb40 (LWP 6223)):
#0  0xb354f39d in clock_gettime () from /lib/libc.so.6
#1  0xb397307c in ?? () from /usr/lib/qt/lib/libQtCore.so.4
#2  0xb3a590c2 in ?? () from /usr/lib/qt/lib/libQtCore.so.4
#3  0xb3a576bb in ?? () from /usr/lib/qt/lib/libQtCore.so.4
#4  0xb3a5774a in ?? () from /usr/lib/qt/lib/libQtCore.so.4
#5  0xb2810143 in g_main_context_prepare () from /usr/lib/libglib-2.0.so.0
#6  0xb2810a5f in ?? () from /usr/lib/libglib-2.0.so.0
#7  0xb2810ca8 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#8  0xb3a5788f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/qt/lib/libQtCore.so.4
#9  0xb3a26d53 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/qt/lib/libQtCore.so.4
#10 0xb3a27079 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/qt/lib/libQtCore.so.4
#11 0xb391578d in QThread::exec() () from /usr/lib/qt/lib/libQtCore.so.4
#12 0xb3a070e4 in ?? () from /usr/lib/qt/lib/libQtCore.so.4
#13 0xb391809f in ?? () from /usr/lib/qt/lib/libQtCore.so.4
#14 0xb3894955 in start_thread () from /lib/libpthread.so.0
#15 0xb353af8e in clone () from /lib/libc.so.6

Thread 5 (Thread 0xa9fffb40 (LWP 6241)):
#0  0xb38986f1 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#1  0xb3918615 in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/qt/lib/libQtCore.so.4
#2  0xb66312ec in ?? () from /usr/lib/libdigikamcore.so.3
#3  0xb391809f in ?? () from /usr/lib/qt/lib/libQtCore.so.4
#4  0xb3894955 in start_thread () from /lib/libpthread.so.0
#5  0xb353af8e in clone () from /lib/libc.so.6

Thread 4 (Thread 0x93845b40 (LWP 6709)):
#0  0xb3897b0a in pthread_mutex_unlock () from /lib/libpthread.so.0
#1  0xb2852cb0 in g_mutex_unlock () from /usr/lib/libglib-2.0.so.0
#2  0xb281012e in g_main_context_prepare () from /usr/lib/libglib-2.0.so.0
#3  0xb2810a5f in ?? () from /usr/lib/libglib-2.0.so.0
#4  0xb2810ca8 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#5  0xb3a5788f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/qt/lib/libQtCore.so.4
#6  0xb3a26d53 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/qt/lib/libQtCore.so.4
#7  0xb3a27079 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/qt/lib/libQtCore.so.4
#8  0xb663085b in ?? () from /usr/lib/libdigikamcore.so.3
#9  0xb390b25a in ?? () from /usr/lib/qt/lib/libQtCore.so.4
#10 0xb391809f in ?? () from /usr/lib/qt/lib/libQtCore.so.4
#11 0xb3894955 in start_thread () from /lib/libpthread.so.0
#12 0xb353af8e in clone () from /lib/libc.so.6

Thread 3 (Thread 0x9d45ab40 (LWP 6710)):
#0  0xb3530391 in poll () from /lib/libc.so.6
#1  0xb281f92b in g_poll () from /usr/lib/libglib-2.0.so.0
#2  0xb2810b68 in ?? () from /usr/lib/libglib-2.0.so.0
#3  0xb2810ca8 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#4  0xb3a5788f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/qt/lib/libQtCore.so.4
#5  0xb3a26d53 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/qt/lib/libQtCore.so.4
#6  0xb3a27079 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/qt/lib/libQtCore.so.4
#7  0xb663085b in ?? () from /usr/lib/libdigikamcore.so.3
#8  0xb390b25a in ?? () from /usr/lib/qt/lib/libQtCore.so.4
#9  0xb391809f in ?? () from /usr/lib/qt/lib/libQtCore.so.4
#10 0xb3894955 in start_thread () from /lib/libpthread.so.0
#11 0xb353af8e in clone () from /lib/libc.so.6

Thread 2 (Thread 0x9cc5ab40 (LWP 6719)):
[KCrash Handler]
#5  0xb3483cdc in raise () from /lib/libc.so.6
#6  0xb34854f3 in abort () from /lib/libc.so.6
#7  0xb36875d5 in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/libstdc++.so.6
#8  0xb3685253 in ?? () from /usr/lib/libstdc++.so.6
#9  0xb368528f in std::terminate() () from /usr/lib/libstdc++.so.6
#10 0xb36852a3 in ?? () from /usr/lib/libstdc++.so.6
#11 0xb3684ddd in __cxa_call_unexpected () from /usr/lib/libstdc++.so.6
#12 0xb3685b00 in operator new(unsigned int) () from /usr/lib/libstdc++.so.6
#13 0xb36e7ca5 in std::string::_Rep::_S_create(unsigned int, unsigned int, std::allocator<char> const&) () from /usr/lib/libstdc++.so.6
#14 0xb36e8e13 in std::string::_Rep::_M_clone(std::allocator<char> const&, unsigned int) () from /usr/lib/libstdc++.so.6
#15 0xb36e8eb1 in std::string::reserve(unsigned int) () from /usr/lib/libstdc++.so.6
#16 0xb36e930a in std::string::append(unsigned int, char) () from /usr/lib/libstdc++.so.6
#17 0xb36e93f7 in std::string::resize(unsigned int, char) () from /usr/lib/libstdc++.so.6
#18 0xb5de1c07 in icvClose(CvFileStorage*, std::string*) () from /usr/local/lib/libopencv_core.so.2.4
#19 0xb5de1f5c in cv::FileStorage::releaseAndGetString() () from /usr/local/lib/libopencv_core.so.2.4
#20 0xb6b5fa02 in ?? () from /usr/lib/libkface.so.2
#21 0xb6b8c6f0 in ?? () from /usr/lib/libkface.so.2
#22 0xb6b62254 in ?? () from /usr/lib/libkface.so.2
#23 0xb6b61edc in ?? () from /usr/lib/libkface.so.2
#24 0xb6b74ad2 in ?? () from /usr/lib/libkface.so.2
#25 0xb6b74171 in KFaceIface::RecognitionDatabase::Private::train(KFaceIface::OpenCVLBPHFaceRecognizer*, QList<KFaceIface::Identity> const&, KFaceIface::TrainingDataProvider*, QString const&) () from /usr/lib/libkface.so.2
#26 0xb6b74218 in KFaceIface::RecognitionDatabase::train(QList<KFaceIface::Identity> const&, KFaceIface::TrainingDataProvider*, QString const&) () from /usr/lib/libkface.so.2
#27 0x082eab88 in ?? ()
#28 0x082e4f55 in ?? ()
#29 0xb3a3967a in QMetaCallEvent::placeMetaCall(QObject*) () from /usr/lib/qt/lib/libQtCore.so.4
#30 0xb3a4153b in QObject::event(QEvent*) () from /usr/lib/qt/lib/libQtCore.so.4
#31 0xb6632524 in Digikam::WorkerObject::event(QEvent*) () from /usr/lib/libdigikamcore.so.3
#32 0xb4006294 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/qt/lib/libQtGui.so.4
#33 0xb400ccc3 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/qt/lib/libQtGui.so.4
#34 0xb4b70814 in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#35 0xb3a2830a in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/qt/lib/libQtCore.so.4
#36 0xb3a2b645 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/qt/lib/libQtCore.so.4
#37 0xb3a2bb6c in QCoreApplication::sendPostedEvents(QObject*, int) () from /usr/lib/qt/lib/libQtCore.so.4
#38 0xb3a5808e in ?? () from /usr/lib/qt/lib/libQtCore.so.4
#39 0xb281083e in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#40 0xb2810be8 in ?? () from /usr/lib/libglib-2.0.so.0
#41 0xb2810ca8 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#42 0xb3a5786f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/qt/lib/libQtCore.so.4
#43 0xb3a26d53 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/qt/lib/libQtCore.so.4
#44 0xb3a27079 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/qt/lib/libQtCore.so.4
#45 0xb663085b in ?? () from /usr/lib/libdigikamcore.so.3
#46 0xb390b25a in ?? () from /usr/lib/qt/lib/libQtCore.so.4
#47 0xb391809f in ?? () from /usr/lib/qt/lib/libQtCore.so.4
#48 0xb3894955 in start_thread () from /lib/libpthread.so.0
#49 0xb353af8e in clone () from /lib/libc.so.6

Thread 1 (Thread 0xac3e1880 (LWP 6213)):
#0  0xb38986f1 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#1  0xb3918615 in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/qt/lib/libQtCore.so.4
#2  0xb6632255 in Digikam::WorkerObject::wait() () from /usr/lib/libdigikamcore.so.3
#3  0x0825257f in ?? ()
#4  0x08252249 in ?? ()
#5  0x08253ad1 in ?? ()
#6  0x0825212c in ?? ()
#7  0x081e3131 in ?? ()
#8  0xb3487139 in __run_exit_handlers () from /lib/libc.so.6
#9  0xb348719d in exit () from /lib/libc.so.6
#10 0xb407a0e8 in ?? () from /usr/lib/qt/lib/libQtGui.so.4
#11 0xb4b6f249 in KApplication::xioErrhandler(_XDisplay*) () from /usr/lib/libkdeui.so.5
#12 0xb4b6f304 in ?? () from /usr/lib/libkdeui.so.5
#13 0xb327c884 in _XIOError () from /usr/lib/libX11.so.6
#14 0xb327a0af in _XEventsQueued () from /usr/lib/libX11.so.6
#15 0xb326b290 in XEventsQueued () from /usr/lib/libX11.so.6
#16 0xb40b572a in ?? () from /usr/lib/qt/lib/libQtGui.so.4
#17 0xb281058f in g_main_context_check () from /usr/lib/libglib-2.0.so.0
#18 0xb2810afa in ?? () from /usr/lib/libglib-2.0.so.0
#19 0xb2810ca8 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#20 0xb3a5786f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/qt/lib/libQtCore.so.4
#21 0xb40b5d4e in ?? () from /usr/lib/qt/lib/libQtGui.so.4
#22 0xb3a26d53 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/qt/lib/libQtCore.so.4
#23 0xb3a27079 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/qt/lib/libQtCore.so.4
#24 0xb3a2c83e in QCoreApplication::exec() () from /usr/lib/qt/lib/libQtCore.so.4
#25 0xb4004724 in QApplication::exec() () from /usr/lib/qt/lib/libQtGui.so.4
#26 0x082f9b4e in ?? ()
#27 0xb346d7a3 in __libc_start_main () from /lib/libc.so.6
#28 0x080c2541 in _start ()

Report to https://bugs.kde.org/




Reproducible: Always

Steps to Reproduce:
1.Select unidentified face in "unknown"  
2.Add or delete tags to face in "unknown"
3.
Actual Results:  
digikam crashes after two or three photos

Expected Results:  
photos successfully tagged and removed from "unknown"

Console Output:-

bash-4.2# digikam
QSqlDatabasePrivate::removeDatabase: connection 'ConnectionTest' is still in use, all queries will cease to work.
terminate called after throwing an instance of 'DJVU::GException'
QSocketNotifier: Invalid socket 7 and type 'Read', disabling...
QSocketNotifier: Invalid socket 10 and type 'Read', disabling...
digikam: Fatal IO error: client killed
KCrash: Application 'digikam' crashing...
KCrash: Attempting to start /usr/lib/kde4/libexec/drkonqi from kdeinit
sock_file=/root/.kde/socket-superslack/kdeinit4__0

[1]+  Stopped                 digikam
bash-4.2# QSocketNotifier: Invalid socket 11 and type 'Read', disabling...








"Unknown" contains 3500 photos





digiKam version 3.4.0
Exiv2 can write to Jp2: Yes
Exiv2 can write to Jpeg: Yes
Exiv2 can write to Pgf: Yes
Exiv2 can write to Png: Yes
Exiv2 can write to Tiff: Yes
Exiv2 supports XMP metadata: Yes
LibCImg: 130
LibEigen: 3.2.0
LibExiv2: 0.23
LibJPEG: 80
LibJasper: 1.900.1
LibKDE: 4.11.1
LibKExiv2: 2.3.1
LibKGeoMap: 2.0.0
LibKdcraw: 2.3.1
LibLCMS: 119
LibLensFun: 0.2.7-0
LibPGF: 6.12.24 - external shared library
LibPNG: 1.5.17
LibQt: 4.8.5
LibRaw: 0.15.3
LibTIFF: LIBTIFF, Version 3.9.6 Copyright (c) 1988-1996 Sam Leffler Copyright (c) 1991-1996 Silicon Graphics, Inc.
Marble Widget: 0.16.1 (stable version)
Parallelized PGF codec: No
Parallelized demosaicing: No
RawSpeed codec support: No
Database backend: QSQLITE
Kipi-Plugins: 3.4.0
LibGphoto2: 2.5.2
LibKface: 3.0.0
LibKipi: 2.1.0
LibOpenCV: 2.4.6.1
Comment 1 caulier.gilles 2014-06-11 21:13:59 UTC
Git commit fa909aa96e7e41225551cd9e866618717f1ea546 by Gilles Caulier.
Committed on 11/06/2014 at 21:06.
Pushed by cgilles into branch 'master'.

use a better C++ exception wrapper to handle non OpenCV exceptions (as pure C++ one)
Related: bug 335624, bug 330342, bug 329873, bug 326742, bug 326586, bug 326585, bug 323888, bug 323361, bug 320812, bug 312440, bug 309027, bug 308645, bug 301611, bug 297558, bug 285517

M  +4    -0    libkface/facedetector.cpp
M  +17   -2    libkface/recognitiondatabase.cpp

http://commits.kde.org/libkface/fa909aa96e7e41225551cd9e866618717f1ea546
Comment 2 caulier.gilles 2014-06-11 21:30:09 UTC
With next digiKam 4.1.0, i fixed libkface to handle all C++ exception (and not only OpenCV exception).

So, at least, digiKam must crash lesser now. If you want to review this entry again, use current implementation from git/master, or wait next 4.1.0 release...

Thanks to update your feedback

Gilles Caulier
Comment 3 caulier.gilles 2014-06-18 14:26:18 UTC
Git commit 4662dd94102f8144bc65ce1cb66d6b6cb1d500fd by Gilles Caulier.
Committed on 18/06/2014 at 14:22.
Pushed by cgilles into branch 'master'.

Libkface now depand of last stable OpenCV library version 2.4.9
This prevent internal crash int Cv:Algorithm that we cannot handle in libkface as exception.
Now, Face Recognition do not crash but still report Exception at training operations, especially about wrong Cv:Matrix size :

digikam(8673)/digikam (core) Digikam::DImg::load:"/mnt/data2/photos/GILLES/NEW/Adrien/2010-04-13/20100413_009.jpg"  :
JPEG file identified
OpenCV Error: Assertion failed (0 <= _dims && _dims <= CV_MAX_DIM) in setSize, file /mnt/devel/opencv/modules/core/src/matrix.cpp, line 89
digikam(8673)/KFACE: cv::Exception training LBPH: /mnt/devel/opencv/modules/core/src/matrix.cpp:89: error: (-215) 0 <=_dims && _dims <= CV_MAX_DIM in function setSize

It still a problem somwhere, but it's better than previous state.
Related: bug 335624, bug 330342, bug 329873, bug 326742, bug 326586, bug 326585, bug 323888, bug 323361, bug 320812, bug 312440, bug 309027, bug 308645, bug 301611, bug 297558, bug 285517

M  +1    -1    CMakeLists.txt

http://commits.kde.org/libkface/4662dd94102f8144bc65ce1cb66d6b6cb1d500fd
Comment 4 caulier.gilles 2014-06-24 12:43:29 UTC
Git commit 1fff86f31e3bf47a2a2cfa6eaa98bb1bdf1a863b by Gilles Caulier.
Committed on 24/06/2014 at 12:32.
Pushed by cgilles into branch 'master'.

add more test before to commit/checkout compressed histogram data in Face database, to prevent crashes, especially if data are corrupted from database.
Related: bug 335624, bug 330342, bug 329873, bug 326742, bug 326586, bug 326585, bug 323888, bug 320812, bug 312440, bug 309027, bug 308645, bug 301611, bug 297558, bug 285517

M  +62   -28   libkface/database/trainingdb.cpp

http://commits.kde.org/libkface/1fff86f31e3bf47a2a2cfa6eaa98bb1bdf1a863b
Comment 5 caulier.gilles 2014-06-24 13:53:18 UTC
With next digiKam 4.1.0, a lots of improvements/fixes have be done around face management. Please give us a fresh feedback.

Note i recommend to delete face recognition database to prevent dysfunction due to possible wrong data store in this container. Look where file is located in my computer :

[gilles@localhost database]$ pwd
/home/gilles/.kde4/share/apps/libkface/database
[gilles@localhost database]$ ls -al
total 397028
drwx------ 2 gilles gilles      4096 juin  24 14:22 ./
drwx------ 3 gilles gilles      4096 juin  18 19:08 ../
-rw-r--r-- 1 gilles gilles 406543360 juin  24 14:22 recognition.db
[gilles@localhost database]$
Comment 6 caulier.gilles 2014-08-24 08:46:29 UTC
We need a fresh feedback of this file using last digiKAm 4.2.0.

Gilles Caulier
Comment 7 caulier.gilles 2015-06-25 13:14:01 UTC
New digiKam 4.11.0 is available with official PKG installer for OSX.

https://www.digikam.org/node/740

Can you reproduce the problem with this release ?
Comment 8 caulier.gilles 2015-08-20 06:51:13 UTC
digiKam 4.12.0 is out :

https://www.digikam.org/node/741

We need a fresh feedback using this release please...
Thanks in advance.

Gilles Caulier
Comment 9 caulier.gilles 2016-07-14 05:53:18 UTC
With next 5.1.0 release, a lots of investigations have be done around OpenCV
face module integration with digiKam Face Engine.
See bug #365202 history for details.
I close this file now. Don't hesistate to re-open if necessary.
Gilles Caulier