Bug 338485

Summary: Crash during Face recognition and detection
Product: [Applications] digikam Reporter: kai <mail>
Component: Faces-RecognitionAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: caulier.gilles, danlyke, pmdumuid
Priority: NOR    
Version: 4.2.0   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 4.4.0
Sentry Crash Report:

Description kai 2014-08-22 19:44:30 UTC
Application: digikam (4.2.0)
KDE Platform Version: 4.13.3
Qt Version: 4.8.6
Operating System: Linux 3.13.0-34-generic x86_64
Distribution: Ubuntu 14.04.1 LTS

-- Information about the crash:
I Select "Detect and recognize faces"  of the face recognition assistent. Then I selecte one image folder. When start the action, the progress bar appears with 0%, the after a few seconds digikam crashes. I repeated it four times, always the same behavior.

The crash can be reproduced every time.

-- Backtrace:
Application: digiKam (digikam), signal: Segmentation fault
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
[Current thread is 1 (Thread 0x7f52523fcac0 (LWP 7816))]

Thread 9 (Thread 0x7f5224c57700 (LWP 7819)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007f524c31e816 in wait (time=18446744073709551615, this=0x2240230) at thread/qwaitcondition_unix.cpp:86
#2  QWaitCondition::wait (this=this@entry=0x2240140, mutex=mutex@entry=0x2240138, time=time@entry=18446744073709551615) at thread/qwaitcondition_unix.cpp:158
#3  0x00000000005f0f6e in Digikam::ScanController::run (this=0x21689e0) at /build/buildd/digikam-4.2.0/core/digikam/database/scancontroller.cpp:725
#4  0x00007f524c31e32f in QThreadPrivate::start (arg=0x21689e0) at thread/qthread_unix.cpp:349
#5  0x00007f524682c8f4 in ?? () from /usr/lib/nvidia-304/libGL.so.1
#6  0x00007f5247354182 in start_thread (arg=0x7f5224c57700) at pthread_create.c:312
#7  0x00007f524b53d38d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 8 (Thread 0x7f521ffff700 (LWP 7820)):
#0  __GI___pthread_mutex_lock (mutex=0x7f5218000a90) at ../nptl/pthread_mutex_lock.c:83
#1  0x00007f5244403991 in g_mutex_lock () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f52443c1557 in g_main_context_prepare () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f52443c1f03 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4  0x00007f52443c20ec in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007f524c44d7be in QEventDispatcherGlib::processEvents (this=0x7f52180008f0, flags=...) at kernel/qeventdispatcher_glib.cpp:436
#6  0x00007f524c41f0af in QEventLoop::processEvents (this=this@entry=0x7f521fffea20, flags=...) at kernel/qeventloop.cpp:149
#7  0x00007f524c41f3a5 in QEventLoop::exec (this=this@entry=0x7f521fffea20, flags=...) at kernel/qeventloop.cpp:204
#8  0x00007f524c31bc5f in QThread::exec (this=this@entry=0x21ba3d0) at thread/qthread.cpp:537
#9  0x00007f524c400823 in QInotifyFileSystemWatcherEngine::run (this=0x21ba3d0) at io/qfilesystemwatcher_inotify.cpp:265
#10 0x00007f524c31e32f in QThreadPrivate::start (arg=0x21ba3d0) at thread/qthread_unix.cpp:349
#11 0x00007f524682c8f4 in ?? () from /usr/lib/nvidia-304/libGL.so.1
#12 0x00007f5247354182 in start_thread (arg=0x7f521ffff700) at pthread_create.c:312
#13 0x00007f524b53d38d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 7 (Thread 0x7f520d46a700 (LWP 7840)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
#1  0x00007f524c31e7f4 in wait (time=30000, this=0x7efebc0) at thread/qwaitcondition_unix.cpp:84
#2  QWaitCondition::wait (this=this@entry=0x7efe970, mutex=mutex@entry=0x6a8f648, time=30000) at thread/qwaitcondition_unix.cpp:158
#3  0x00007f524c3120fa in QThreadPoolThread::run (this=0x7efe960) at concurrent/qthreadpool.cpp:142
#4  0x00007f524c31e32f in QThreadPrivate::start (arg=0x7efe960) at thread/qthread_unix.cpp:349
#5  0x00007f524682c8f4 in ?? () from /usr/lib/nvidia-304/libGL.so.1
#6  0x00007f5247354182 in start_thread (arg=0x7f520d46a700) at pthread_create.c:312
#7  0x00007f524b53d38d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 6 (Thread 0x7f520b466700 (LWP 7844)):
#0  0x00007f524b530049 in poll () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007f52443c1fe4 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f52443c20ec in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f524c44d7be in QEventDispatcherGlib::processEvents (this=0x7f5220096510, flags=...) at kernel/qeventdispatcher_glib.cpp:436
#4  0x00007f524c41f0af in QEventLoop::processEvents (this=this@entry=0x7f520b4659e0, flags=...) at kernel/qeventloop.cpp:149
#5  0x00007f524c41f3a5 in QEventLoop::exec (this=this@entry=0x7f520b4659e0, flags=...) at kernel/qeventloop.cpp:204
#6  0x00007f524fa7d633 in Digikam::WorkerObjectRunnable::run (this=0xd0ba540) at /build/buildd/digikam-4.2.0/core/libs/threads/threadmanager.cpp:196
#7  0x00007f524c311fee in QThreadPoolThread::run (this=0x7effe60) at concurrent/qthreadpool.cpp:108
#8  0x00007f524c31e32f in QThreadPrivate::start (arg=0x7effe60) at thread/qthread_unix.cpp:349
#9  0x00007f524682c8f4 in ?? () from /usr/lib/nvidia-304/libGL.so.1
#10 0x00007f5247354182 in start_thread (arg=0x7f520b466700) at pthread_create.c:312
#11 0x00007f524b53d38d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 5 (Thread 0x7f52037fe700 (LWP 7851)):
#0  0x00007f524b53003d in poll () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007f52443c1fe4 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f52443c20ec in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f524c44d7be in QEventDispatcherGlib::processEvents (this=0x7f51ec0008f0, flags=...) at kernel/qeventdispatcher_glib.cpp:436
#4  0x00007f524c41f0af in QEventLoop::processEvents (this=this@entry=0x7f52037fd9e0, flags=...) at kernel/qeventloop.cpp:149
#5  0x00007f524c41f3a5 in QEventLoop::exec (this=this@entry=0x7f52037fd9e0, flags=...) at kernel/qeventloop.cpp:204
#6  0x00007f524fa7d633 in Digikam::WorkerObjectRunnable::run (this=0xf20eae0) at /build/buildd/digikam-4.2.0/core/libs/threads/threadmanager.cpp:196
#7  0x00007f524c311fee in QThreadPoolThread::run (this=0x7f024e0) at concurrent/qthreadpool.cpp:108
#8  0x00007f524c31e32f in QThreadPrivate::start (arg=0x7f024e0) at thread/qthread_unix.cpp:349
#9  0x00007f524682c8f4 in ?? () from /usr/lib/nvidia-304/libGL.so.1
#10 0x00007f5247354182 in start_thread (arg=0x7f52037fe700) at pthread_create.c:312
#11 0x00007f524b53d38d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 4 (Thread 0x7f5201ffb700 (LWP 7854)):
#0  0x00007f524b53003d in poll () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007f52443c1fe4 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f52443c20ec in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f524c44d7be in QEventDispatcherGlib::processEvents (this=0x7f51dc0008f0, flags=...) at kernel/qeventdispatcher_glib.cpp:436
#4  0x00007f524c41f0af in QEventLoop::processEvents (this=this@entry=0x7f5201ffa9e0, flags=...) at kernel/qeventloop.cpp:149
#5  0x00007f524c41f3a5 in QEventLoop::exec (this=this@entry=0x7f5201ffa9e0, flags=...) at kernel/qeventloop.cpp:204
#6  0x00007f524fa7d633 in Digikam::WorkerObjectRunnable::run (this=0xc79d9d0) at /build/buildd/digikam-4.2.0/core/libs/threads/threadmanager.cpp:196
#7  0x00007f524c311fee in QThreadPoolThread::run (this=0x7f03560) at concurrent/qthreadpool.cpp:108
#8  0x00007f524c31e32f in QThreadPrivate::start (arg=0x7f03560) at thread/qthread_unix.cpp:349
#9  0x00007f524682c8f4 in ?? () from /usr/lib/nvidia-304/libGL.so.1
#10 0x00007f5247354182 in start_thread (arg=0x7f5201ffb700) at pthread_create.c:312
#11 0x00007f524b53d38d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 3 (Thread 0x7f52007f8700 (LWP 7857)):
[KCrash Handler]
#6  0x00007f5250814080 in KFaceIface::Identity::isNull() const () from /usr/lib/libkface.so.2
#7  0x00000000006ffb32 in Digikam::DatabaseWriter::process (this=0xddf1e00, package=...) at /build/buildd/digikam-4.2.0/core/utilities/facemanagement/facepipeline.cpp:663
#8  0x0000000000700361 in Digikam::DatabaseWriter::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>) at /build/buildd/digikam-4.2.0/obj-x86_64-linux-gnu/core/digikam/facepipeline_p.moc:493
#9  0x00007f524c438c1e in QObject::event (this=0xddf1e00, e=<optimized out>) at kernel/qobject.cpp:1194
#10 0x00007f524ce12e2c in QApplicationPrivate::notify_helper (this=this@entry=0x1f31e30, receiver=receiver@entry=0xddf1e00, e=e@entry=0x7f51dc003350) at kernel/qapplication.cpp:4567
#11 0x00007f524ce194a0 in QApplication::notify (this=this@entry=0x7fffaa2880f0, receiver=receiver@entry=0xddf1e00, e=e@entry=0x7f51dc003350) at kernel/qapplication.cpp:4353
#12 0x00007f524db1dd1a in KApplication::notify (this=0x7fffaa2880f0, receiver=0xddf1e00, event=0x7f51dc003350) at ../../kdeui/kernel/kapplication.cpp:311
#13 0x00007f524c4204dd in QCoreApplication::notifyInternal (this=0x7fffaa2880f0, receiver=receiver@entry=0xddf1e00, event=event@entry=0x7f51dc003350) at kernel/qcoreapplication.cpp:953
#14 0x00007f524c423b3d in sendEvent (event=0x7f51dc003350, receiver=0xddf1e00) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#15 QCoreApplicationPrivate::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=0x7f047e0) at kernel/qcoreapplication.cpp:1577
#16 0x00007f524c423fe3 in QCoreApplication::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0) at kernel/qcoreapplication.cpp:1470
#17 0x00007f524c44df83 in sendPostedEvents () at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:236
#18 postEventSourceDispatch (s=0x7f51f0001380) at kernel/qeventdispatcher_glib.cpp:287
#19 0x00007f52443c1e04 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#20 0x00007f52443c2048 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#21 0x00007f52443c20ec in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#22 0x00007f524c44d7a1 in QEventDispatcherGlib::processEvents (this=0x7f51f00008f0, flags=...) at kernel/qeventdispatcher_glib.cpp:434
#23 0x00007f524c41f0af in QEventLoop::processEvents (this=this@entry=0x7f52007f79e0, flags=...) at kernel/qeventloop.cpp:149
#24 0x00007f524c41f3a5 in QEventLoop::exec (this=this@entry=0x7f52007f79e0, flags=...) at kernel/qeventloop.cpp:204
#25 0x00007f524fa7d633 in Digikam::WorkerObjectRunnable::run (this=0x84e2cf0) at /build/buildd/digikam-4.2.0/core/libs/threads/threadmanager.cpp:196
#26 0x00007f524c311fee in QThreadPoolThread::run (this=0x7f04640) at concurrent/qthreadpool.cpp:108
#27 0x00007f524c31e32f in QThreadPrivate::start (arg=0x7f04640) at thread/qthread_unix.cpp:349
#28 0x00007f524682c8f4 in ?? () from /usr/lib/nvidia-304/libGL.so.1
#29 0x00007f5247354182 in start_thread (arg=0x7f52007f8700) at pthread_create.c:312
#30 0x00007f524b53d38d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 2 (Thread 0x7f51fd7f2700 (LWP 7926)):
#0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007f52465662db in ?? () from /usr/lib/libtbb.so.2
#2  0x00007f52465662f9 in ?? () from /usr/lib/libtbb.so.2
#3  0x00007f524682c8f4 in ?? () from /usr/lib/nvidia-304/libGL.so.1
#4  0x00007f5247354182 in start_thread (arg=0x7f51fd7f2700) at pthread_create.c:312
#5  0x00007f524b53d38d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 1 (Thread 0x7f52523fcac0 (LWP 7816)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007f524c31e816 in wait (time=18446744073709551615, this=0x244a9c0) at thread/qwaitcondition_unix.cpp:86
#2  QWaitCondition::wait (this=this@entry=0x6a8f670, mutex=mutex@entry=0x6a8f648, time=time@entry=18446744073709551615) at thread/qwaitcondition_unix.cpp:158
#3  0x00007f524c311242 in QThreadPoolPrivate::waitForDone (this=0x6a8f5c0, msecs=msecs@entry=-1) at concurrent/qthreadpool.cpp:295
#4  0x00007f524c3126b5 in QThreadPool::~QThreadPool (this=0x244e940, __in_chrg=<optimized out>) at concurrent/qthreadpool.cpp:438
#5  0x00007f524c3126e9 in QThreadPool::~QThreadPool (this=0x244e940, __in_chrg=<optimized out>) at concurrent/qthreadpool.cpp:440
#6  0x00007f524c437168 in QObjectPrivate::deleteChildren (this=this@entry=0x20f0100) at kernel/qobject.cpp:1907
#7  0x00007f524c4396ff in QObject::~QObject (this=0x2220ca0, __in_chrg=<optimized out>) at kernel/qobject.cpp:926
#8  0x00007f524fa7cf27 in ~ThreadManagerCreator (this=0x2220ca0, __in_chrg=<optimized out>) at /build/buildd/digikam-4.2.0/core/libs/threads/threadmanager.cpp:236
#9  destroy () at /build/buildd/digikam-4.2.0/core/libs/threads/threadmanager.cpp:241
#10 0x00007f524b47e519 in __run_exit_handlers (status=1, listp=0x7f524b8016c8 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true) at exit.c:82
#11 0x00007f524b47e565 in __GI_exit (status=<optimized out>) at exit.c:104
#12 0x00007f5239100224 in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#13 0x00007f524db1c8d0 in KApplication::xioErrhandler (this=0x7fffaa2880f0, dpy=0x1f35640) at ../../kdeui/kernel/kapplication.cpp:419
#14 0x00007f5249a345ee in _XIOError () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#15 0x00007f5249a31fed in _XEventsQueued () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#16 0x00007f5249a240db in XEventsQueued () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#17 0x00007f524ceb462c in x11EventSourceCheck (s=0x1f2d880) at kernel/qguieventdispatcher_glib.cpp:85
#18 0x00007f52443c1a61 in g_main_context_check () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#19 0x00007f52443c1f7b in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#20 0x00007f52443c20ec in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#21 0x00007f524c44d7be in QEventDispatcherGlib::processEvents (this=0x1e548b0, flags=...) at kernel/qeventdispatcher_glib.cpp:436
#22 0x00007f524ceb4bb6 in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#23 0x00007f524c41f0af in QEventLoop::processEvents (this=this@entry=0x7fffaa287bd0, flags=...) at kernel/qeventloop.cpp:149
#24 0x00007f524c41f3a5 in QEventLoop::exec (this=this@entry=0x7fffaa287bd0, flags=...) at kernel/qeventloop.cpp:204
#25 0x00007f524c424b79 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1225
#26 0x00007f524ce1137c in QApplication::exec () at kernel/qapplication.cpp:3828
#27 0x00000000004954e0 in main (argc=<optimized out>, argv=<optimized out>) at /build/buildd/digikam-4.2.0/core/digikam/main/main.cpp:236
Comment 1 caulier.gilles 2014-08-24 08:49:27 UTC
Marcel,

How a crash can appears about a null identity ?

I suspect that trace is not valid due to a memory corruption (memory allocation is full ?)

Gilles Caulier
Comment 2 caulier.gilles 2014-08-24 12:10:53 UTC
*** Bug 317413 has been marked as a duplicate of this bug. ***
Comment 3 Pierre Dumuid 2014-09-11 15:33:49 UTC
I am also getting this crash on gentoo:

My packages are:
media-gfx/digikam-4.2.0
media-libs/libkface-4.2.0

and after re-compiling digikam with debug symbols, and running digikam with kdbg, I observe similar backtrack, in particular, the crash I get is at 663 of  core/utilities/facemanagement/facepipeline.cpp

which is where Thread 3 has a stack-trace for in the above stacktrace.

It would appear that the variable i, which has a maximum of package->databaseFaces.size(), must somehow be exceeding the size of package->recognitionResults in the function,  DatabaseWriter::process().

I have also verified that the file utilities/facemanagement/facepipeline.cpp at git revision 8af217bd0ee7fcc1600024e76f252dbb9848f130 (being master as of today) matches the one my gentoo system is compiling, so the line number 663 is currently the same problematic line-number for me.
Comment 4 caulier.gilles 2014-09-11 17:14:14 UTC
Git commit 6f97d6d346104ac4dc8159fc7c644929d117dd24 by Gilles Caulier.
Committed on 11/09/2014 at 17:13.
Pushed by cgilles into branch 'master'.

work around index exeeding container size

M  +2    -1    utilities/facemanagement/facepipeline.cpp

http://commits.kde.org/digikam/6f97d6d346104ac4dc8159fc7c644929d117dd24
Comment 5 caulier.gilles 2014-09-11 17:15:24 UTC
Pierre,

My simple fix commited in comment #4 fix the problem on you computer ?

Note : I cannot reproduce the dysfunction on my computer.

Gilles Caulier
Comment 6 Pierre Dumuid 2014-09-11 23:14:36 UTC
Yes Gilles, that fixed my problem.
Comment 7 caulier.gilles 2014-09-12 05:51:30 UTC
Git commit 7b214db81133180418c29097d1f0fce62860a47f by Gilles Caulier.
Committed on 12/09/2014 at 05:51.
Pushed by cgilles into branch 'master'.

add comment
FIXED-IN: 4.4.0

M  +2    -1    NEWS
M  +1    -0    utilities/facemanagement/facepipeline.cpp

http://commits.kde.org/digikam/7b214db81133180418c29097d1f0fce62860a47f