Bug 263272 - Face Detection crashes on folders containing videos
Summary: Face Detection crashes on folders containing videos
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Unclassified
Component: Faces-Detection (show other bugs)
Version: 2.0.0
Platform: Compiled Sources Linux
: NOR crash (vote)
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-16 00:48 UTC by Andrew Coles
Modified: 2017-07-26 17:59 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 2.0.0


Attachments
Patch to stop the same DynamicThread::run() function being called twice in parallel (589 bytes, patch)
2011-01-22 12:42 UTC, Andrew Coles
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Coles 2011-01-16 00:48:20 UTC
Version:           unspecified (using KDE 4.5.95) 
OS:                Linux

When scanning for faces, digikam crashes when it gets to any video files in a folder.

Reproducible: Always

Steps to Reproduce:
Put some .MPG files in a folder, scan for faces.



The console output immediately before the crash:

[New Thread 0x922c5b70 (LWP 3591)]
[New Thread 0x862adb70 (LWP 3592)]
[New Thread 0x8f80eb70 (LWP 3593)]
digikam(2352)/digikam (core) Digikam::PreviewLoadingTask::execute: Cannot extract preview for  "/home/amanda/blue/Photos/2009 - 10 - Edinburgh Bouncing Competition/1402673031350_25663.mp4" 
Cascade directory located as : /usr/share/opencv/haarcascades
Cascade directory located as : /usr/share/opencv/haarcascades
[New Thread 0x92ec8b70 (LWP 3600)]
digikam(2352)/digikam (core) Digikam::PreviewLoadingTask::execute: Cannot extract preview for  "/home/amanda/blue/Photos/2009 - 10 - Edinburgh Bouncing Competition/EdinburghNovice.wmv" 
No location could be retrieved for url KUrl("file://") 
digikam(2352)/digikam (core) Digikam::ThumbnailCreator::load: Thumbnail is null for  "" 
No location could be retrieved for url KUrl("file://") 
digikam(2352)/digikam (core) Digikam::ThumbnailCreator::load: Thumbnail is null for  "" 
No location could be retrieved for url KUrl("file://") 
digikam(2352)/digikam (core) Digikam::ThumbnailCreator::load: Thumbnail is null for  "" 
No location could be retrieved for url KUrl("file://") 
digikam(2352)/digikam (core) Digikam::ThumbnailCreator::load: Thumbnail is null for  "" 
digikam(2352)/digikam (core) Digikam::PreviewLoadingTask::execute: Cannot extract preview for  "/home/amanda/blue/Photos/2009 - 10 - Edinburgh Bouncing Competition/MOV01671.MPG" 
digikam(2352)/digikam (core) Digikam::PreviewLoadingTask::execute: Cannot extract preview for  "/home/amanda/blue/Photos/2009 - 10 - Edinburgh Bouncing Competition/MOV01674.MPG" 
digikam(2352)/digikam (core) Digikam::PreviewLoadingTask::execute: Cannot extract preview for  "/home/amanda/blue/Photos/2009 - 10 - Edinburgh Bouncing Competition/MOV01675.MPG" 
pure virtual method called
terminate called without an active exception

The backtrace:

Thread 71 (Thread 0x92ec8b70 (LWP 3600)):
#0  0xb7fe1424 in __kernel_vsyscall ()
#1  0xb49d99b3 in ___xstat64 (vers=3, name=0xaf41a28 "/home/amanda/blue/Photos/2009 - 10 - Edinburgh Bouncing Competition/MOV01676.MPG", 
    buf=0xc2a57f4) at ../sysdeps/unix/sysv/linux/xstat64.c:50
#2  0xb4e4fbe5 in stat64 (this=0xc2a57d0) at /usr/include/sys/stat.h:506
#3  QFSFileEnginePrivate::doStat (this=0xc2a57d0) at io/qfsfileengine_unix.cpp:707
#4  0xb4e52cf1 in QFSFileEngine::fileFlags (this=0xa748498, type=DWARF-2 expression error: DW_OP_reg operations must be used either alone or in conjuction with DW_OP_piece or DW_OP_bit_piece.
) at io/qfsfileengine_unix.cpp:820
#5  0xb4e078a9 in QFileInfoPrivate::getFileFlags (this=0xab01f80, request=...) at io/qfileinfo.cpp:158
#6  0xb4e0798c in QFileInfo::exists (this=0x92ec78c8) at io/qfileinfo.cpp:629
#7  0xb6b582a5 in Digikam::DImg::fileFormat (filePath=...) at /home/amanda/kde/tools/src/digikam/core/libs/dimg/dimg.cpp:700
#8  0xb6d58ac9 in Digikam::PreviewLoadingTask::execute (this=0xb470630)
    at /home/amanda/kde/tools/src/digikam/core/libs/threadimageio/previewtask.cpp:203
#9  0xb6d40bd3 in Digikam::LoadSaveThread::run (this=0xba00948) at /home/amanda/kde/tools/src/digikam/core/libs/threadimageio/loadsavethread.cpp:116
#10 0xb6d8e8ee in Digikam::DynamicThread::DynamicThreadPriv::run (this=0xb456108)
    at /home/amanda/kde/tools/src/digikam/core/libs/threads/dynamicthread.cpp:324
#11 0xb4d6e523 in QThreadPoolThread::run (this=0xa1c84b0) at concurrent/qthreadpool.cpp:106
#12 0xb4d79df9 in QThreadPrivate::start (arg=0xa1c84b0) at thread/qthread_unix.cpp:266
#13 0xb3a38cc9 in start_thread (arg=0x92ec8b70) at pthread_create.c:304
#14 0xb49eb69e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 70 (Thread 0x8f80eb70 (LWP 3593)):
#0  0xb7fe1424 in __kernel_vsyscall ()
#1  0xb4945941 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#2  0xb4948e42 in abort () at abort.c:92
#3  0xb4b68055 in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/libstdc++.so.6
#4  0xb4b65f35 in ?? () from /usr/lib/libstdc++.so.6
#5  0xb4b65f72 in std::terminate() () from /usr/lib/libstdc++.so.6
#6  0xb4b66b85 in __cxa_pure_virtual () from /usr/lib/libstdc++.so.6
#7  0xb6d4f086 in Digikam::LoadingCache::notifyNewLoadingProcess (this=0x869d600, process=0xb09de70, description=DWARF-2 expression error: DW_OP_reg operations must be used either alone or in conjuction with DW_OP_piece or DW_OP_bit_piece.
)
    at /home/amanda/kde/tools/src/digikam/core/libs/threadimageio/loadingcache.cpp:171
#8  0xb6d594ad in Digikam::PreviewLoadingTask::execute (this=0xb09dd18)
    at /home/amanda/kde/tools/src/digikam/core/libs/threadimageio/previewtask.cpp:171
#9  0xb6d40bd3 in Digikam::LoadSaveThread::run (this=0xba00948) at /home/amanda/kde/tools/src/digikam/core/libs/threadimageio/loadsavethread.cpp:116
#10 0xb6d8e8ee in Digikam::DynamicThread::DynamicThreadPriv::run (this=0xb456108)
    at /home/amanda/kde/tools/src/digikam/core/libs/threads/dynamicthread.cpp:324
#11 0xb4d6e523 in QThreadPoolThread::run (this=0xa195738) at concurrent/qthreadpool.cpp:106
#12 0xb4d79df9 in QThreadPrivate::start (arg=0xa195738) at thread/qthread_unix.cpp:266
#13 0xb3a38cc9 in start_thread (arg=0x8f80eb70) at pthread_create.c:304
#14 0xb49eb69e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 69 (Thread 0x862adb70 (LWP 3592)):
#0  0xb7fe1424 in __kernel_vsyscall ()
#1  0xb49dcdf6 in __poll (fds=0xb4a73ff4, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:87
#2  0xb38a7a1b in g_poll () from /lib/libglib-2.0.so.0
#3  0xb389a43c in ?? () from /lib/libglib-2.0.so.0
#4  0xb389a848 in g_main_context_iteration () from /lib/libglib-2.0.so.0
#5  0xb4eaa565 in QEventDispatcherGlib::processEvents (this=0xa71ed60, flags=...) at kernel/qeventdispatcher_glib.cpp:415
#6  0xb4e7a609 in QEventLoop::processEvents (this=0x862ad120, flags=DWARF-2 expression error: DW_OP_reg operations must be used either alone or in conjuction with DW_OP_piece or DW_OP_bit_piece.
) at kernel/qeventloop.cpp:149
#7  0xb4e7aa8a in QEventLoop::exec (this=0x862ad120, flags=...) at kernel/qeventloop.cpp:201
#8  0xb6d8c24c in Digikam::WorkerObjectRunnable::run (this=0xa8396d0) at /home/amanda/kde/tools/src/digikam/core/libs/threads/threadmanager.cpp:190
#9  0xb4d6e523 in QThreadPoolThread::run (this=0x9fab3f0) at concurrent/qthreadpool.cpp:106
#10 0xb4d79df9 in QThreadPrivate::start (arg=0x9fab3f0) at thread/qthread_unix.cpp:266
#11 0xb3a38cc9 in start_thread (arg=0x862adb70) at pthread_create.c:304
#12 0xb49eb69e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 68 (Thread 0x922c5b70 (LWP 3591)):
#0  0xb7fe1424 in __kernel_vsyscall ()
#1  0xb49dcdf6 in __poll (fds=0xb4a73ff4, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:87
#2  0xb38a7a1b in g_poll () from /lib/libglib-2.0.so.0
#3  0xb389a43c in ?? () from /lib/libglib-2.0.so.0
#4  0xb389a848 in g_main_context_iteration () from /lib/libglib-2.0.so.0
#5  0xb4eaa565 in QEventDispatcherGlib::processEvents (this=0x9a8fd48, flags=...) at kernel/qeventdispatcher_glib.cpp:415
#6  0xb4e7a609 in QEventLoop::processEvents (this=0x922c5120, flags=DWARF-2 expression error: DW_OP_reg operations must be used either alone or in conjuction with DW_OP_piece or DW_OP_bit_piece.
) at kernel/qeventloop.cpp:149
#7  0xb4e7aa8a in QEventLoop::exec (this=0x922c5120, flags=...) at kernel/qeventloop.cpp:201
#8  0xb6d8c24c in Digikam::WorkerObjectRunnable::run (this=0xa87feb0) at /home/amanda/kde/tools/src/digikam/core/libs/threads/threadmanager.cpp:190
#9  0xb4d6e523 in QThreadPoolThread::run (this=0x9fafa38) at concurrent/qthreadpool.cpp:106
#10 0xb4d79df9 in QThreadPrivate::start (arg=0x9fafa38) at thread/qthread_unix.cpp:266
#11 0xb3a38cc9 in start_thread (arg=0x922c5b70) at pthread_create.c:304
#12 0xb49eb69e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 66 (Thread 0x8eabeb70 (LWP 3232)):
#0  0xb43d4f2a in icvEvalHidHaarClassifier(CvHidHaarClassifier*, double, unsigned int) () from /usr/lib/libcv.so.2.1
#1  0xb43d62a9 in cvRunHaarClassifierCascade () from /usr/lib/libcv.so.2.1
#2  0xb43e213a in cvHaarDetectObjects () from /usr/lib/libcv.so.2.1
#3  0xb45d70fc in libface::FaceDetect::cascadeResult(_IplImage const*, CvHaarClassifierCascade*, libface::DetectObjectParameters const&) ()
   from /usr/lib/libface.so.0
#4  0xb45d7d94 in libface::FaceDetect::detectFaces(_IplImage const*, CvSize const&) () from /usr/lib/libface.so.0
#5  0xb45e2c2b in libface::LibFace::detectFaces(_IplImage const*, CvSize const&) () from /usr/lib/libface.so.0
#6  0xb7764d68 in KFaceIface::Database::detectFaces (this=0xbb827a0, image=...)
    at /home/amanda/kde/tools/src/digikam/extra/libkface/libkface/database.cpp:187
#7  0xb776acfc in KFaceIface::FaceDetector::detectFaces (this=0xac268c4, image=...)
    at /home/amanda/kde/tools/src/digikam/extra/libkface/libkface/facedetector.cpp:107
#8  0x0830b9a6 in Digikam::DetectionWorker::process (this=0xac268b8, package=DWARF-2 expression error: DW_OP_reg operations must be used either alone or in conjuction with DW_OP_piece or DW_OP_bit_piece.
)
    at /home/amanda/kde/tools/src/digikam/core/utilities/facedetection/facepipeline.cpp:457
#9  0x0830bdd5 in Digikam::DetectionWorker::qt_metacall (this=0xac268b8, _c=QMetaObject::InvokeMetaMethod, _id=1, _a=0x98432c8)
    at /home/amanda/kde/tools/build/digikam/core/digikam/facepipeline_p.moc:300
#10 0xb4e818ca in QMetaObject::metacall (object=0xac268b8, cl=2529306320, idx=10, argv=0x98432c8) at kernel/qmetaobject.cpp:237
#11 0xb4e8cdf6 in QMetaCallEvent::placeMetaCall (this=0x9e8a398, object=0xac268b8) at kernel/qobject.cpp:534
#12 0xb4e8e6a2 in QObject::event (this=0xac268b8, e=0xe814c) at kernel/qobject.cpp:1219
#13 0xb6d8d021 in Digikam::WorkerObject::event (this=0xac268b8, e=0x9510d430)
    at /home/amanda/kde/tools/src/digikam/core/libs/threads/workerobject.cpp:133
#14 0xb53dafdc in QApplicationPrivate::notify_helper (this=0x85c4f18, receiver=0xac268b8, e=0x9e8a398) at kernel/qapplication.cpp:4396
#15 0xb53e104e in QApplication::notify (this=0xbfffef1c, receiver=0xac268b8, e=0x9e8a398) at kernel/qapplication.cpp:3798
#16 0xb5f82f8a in KApplication::notify (this=0xbfffef1c, receiver=0xac268b8, event=0x9e8a398) at ../../kdeui/kernel/kapplication.cpp:311
#17 0xb4e7bb3b in QCoreApplication::notifyInternal (this=0xbfffef1c, receiver=0xac268b8, event=0x9e8a398) at kernel/qcoreapplication.cpp:732
#18 0xb4e7ed8b in sendEvent (receiver=0x0, event_type=0, data=0xa1c3b40) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:215
#19 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0xa1c3b40) at kernel/qcoreapplication.cpp:1373
#20 0xb4e7ef4d in QCoreApplication::sendPostedEvents (receiver=0x0, event_type=0) at kernel/qcoreapplication.cpp:1266
#21 0xb4eaaa74 in sendPostedEvents (s=0xb082650) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:220
#22 postEventSourceDispatch (s=0xb082650) at kernel/qeventdispatcher_glib.cpp:277
#23 0xb3896855 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#24 0xb389a668 in ?? () from /lib/libglib-2.0.so.0
#25 0xb389a848 in g_main_context_iteration () from /lib/libglib-2.0.so.0
#26 0xb4eaa565 in QEventDispatcherGlib::processEvents (this=0xb88bbc0, flags=...) at kernel/qeventdispatcher_glib.cpp:415
#27 0xb4e7a609 in QEventLoop::processEvents (this=0x8eabe120, flags=DWARF-2 expression error: DW_OP_reg operations must be used either alone or in conjuction with DW_OP_piece or DW_OP_bit_piece.
) at kernel/qeventloop.cpp:149
#28 0xb4e7aa8a in QEventLoop::exec (this=0x8eabe120, flags=...) at kernel/qeventloop.cpp:201
#29 0xb6d8c24c in Digikam::WorkerObjectRunnable::run (this=0x9ec4230) at /home/amanda/kde/tools/src/digikam/core/libs/threads/threadmanager.cpp:190
#30 0xb4d6e523 in QThreadPoolThread::run (this=0xa1c39f0) at concurrent/qthreadpool.cpp:106
#31 0xb4d79df9 in QThreadPrivate::start (arg=0xa1c39f0) at thread/qthread_unix.cpp:266
#32 0xb3a38cc9 in start_thread (arg=0x8eabeb70) at pthread_create.c:304
#33 0xb49eb69e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 62 (Thread 0x90013b70 (LWP 2982)):
#0  0xb7fe1424 in __kernel_vsyscall ()
#1  0xb3a3d4dc in pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/pthread_cond_wait.S:169
#2  0xb49f8d9d in __pthread_cond_wait (cond=0xa1c6a2c, mutex=0xa1c6a14) at forward.c:139
#3  0xa2d9df3c in ?? () from /usr/lib/libxine.so.1
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Thread 61 (Thread 0x90815b70 (LWP 2981)):
#0  0xb7fe1424 in __kernel_vsyscall ()
#1  0xb3a3d4dc in pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/pthread_cond_wait.S:169
#2  0xb49f8d9d in __pthread_cond_wait (cond=0xb9f538c, mutex=0xb9f5374) at forward.c:139
#3  0xa2d8c6c8 in ?? () from /usr/lib/libxine.so.1
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Thread 60 (Thread 0x91016b70 (LWP 2980)):
#0  0xb7fe1424 in __kernel_vsyscall ()
#1  0xb3a3d4dc in pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/pthread_cond_wait.S:169
#2  0xb49f8d9d in __pthread_cond_wait (cond=0xaf02714, mutex=0xaf026fc) at forward.c:139
#3  0xa2d8c6c8 in ?? () from /usr/lib/libxine.so.1
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Thread 59 (Thread 0x8cabab70 (LWP 2939)):
#0  0xb7fe1424 in __kernel_vsyscall ()
#1  0xb49dcdf6 in __poll (fds=0xb4a73ff4, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:87
#2  0xb38a7a1b in g_poll () from /lib/libglib-2.0.so.0
#3  0xb389a43c in ?? () from /lib/libglib-2.0.so.0
#4  0xb389a848 in g_main_context_iteration () from /lib/libglib-2.0.so.0
#5  0xb4eaa565 in QEventDispatcherGlib::processEvents (this=0xa5fc360, flags=...) at kernel/qeventdispatcher_glib.cpp:415
#6  0xb4e7a609 in QEventLoop::processEvents (this=0x8caba120, flags=DWARF-2 expression error: DW_OP_reg operations must be used either alone or in conjuction with DW_OP_piece or DW_OP_bit_piece.
) at kernel/qeventloop.cpp:149
#7  0xb4e7aa8a in QEventLoop::exec (this=0x8caba120, flags=...) at kernel/qeventloop.cpp:201
#8  0xb6d8c24c in Digikam::WorkerObjectRunnable::run (this=0xac2e4e8) at /home/amanda/kde/tools/src/digikam/core/libs/threads/threadmanager.cpp:190
#9  0xb4d6e523 in QThreadPoolThread::run (this=0xa193dc0) at concurrent/qthreadpool.cpp:106
#10 0xb4d79df9 in QThreadPrivate::start (arg=0xa193dc0) at thread/qthread_unix.cpp:266
#11 0xb3a38cc9 in start_thread (arg=0x8cabab70) at pthread_create.c:304
#12 0xb49eb69e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 12 (Thread 0x98748b70 (LWP 2404)):
#0  0xb7fe1424 in __kernel_vsyscall ()
#1  0xb3a3d4dc in pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/pthread_cond_wait.S:169
#2  0xb49f8d9d in __pthread_cond_wait (cond=0x928fe30, mutex=0x928fe18) at forward.c:139
#3  0xa2d9ab54 in ?? () from /usr/lib/libxine.so.1
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Thread 11 (Thread 0x9cf8cb70 (LWP 2403)):
#0  0xb7fe1424 in __kernel_vsyscall ()
#1  0xb49dcdf6 in __poll (fds=0xb4a73ff4, nfds=2, timeout=1498) at ../sysdeps/unix/sysv/linux/poll.c:87
#2  0xb4909562 in ?? () from /usr/lib/libpulse.so.0
#3  0xb48f5ab9 in pa_mainloop_poll () from /usr/lib/libpulse.so.0
#4  0xb48f7a73 in pa_mainloop_iterate () from /usr/lib/libpulse.so.0
#5  0xb48f7b44 in pa_mainloop_run () from /usr/lib/libpulse.so.0
#6  0xb4909303 in ?? () from /usr/lib/libpulse.so.0
#7  0xb346abd5 in ?? () from /usr/lib/libpulsecommon-0.9.21.so
#8  0xb3a38cc9 in start_thread (arg=0x9cf8cb70) at pthread_create.c:304
#9  0xb49eb69e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 10 (Thread 0x9d78db70 (LWP 2402)):
#0  0xb7fe1424 in __kernel_vsyscall ()
#1  0xb49dcdf6 in __poll (fds=0xb4a73ff4, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:87
#2  0xb38a7a1b in g_poll () from /lib/libglib-2.0.so.0
#3  0xb389a43c in ?? () from /lib/libglib-2.0.so.0
#4  0xb389a848 in g_main_context_iteration () from /lib/libglib-2.0.so.0
#5  0xb4eaa565 in QEventDispatcherGlib::processEvents (this=0x926b418, flags=...) at kernel/qeventdispatcher_glib.cpp:415
#6  0xb4e7a609 in QEventLoop::processEvents (this=0x9d78d100, flags=DWARF-2 expression error: DW_OP_reg operations must be used either alone or in conjuction with DW_OP_piece or DW_OP_bit_piece.
) at kernel/qeventloop.cpp:149
#7  0xb4e7aa8a in QEventLoop::exec (this=0x9d78d100, flags=...) at kernel/qeventloop.cpp:201
#8  0xb4d76b7e in QThread::exec (this=0x926b018) at thread/qthread.cpp:490
#9  0xa2dfddaa in ?? () from /usr/lib/qt4/plugins/phonon_backend/phonon_xine.so
#10 0xb4d79df9 in QThreadPrivate::start (arg=0x926b018) at thread/qthread_unix.cpp:266
#11 0xb3a38cc9 in start_thread (arg=0x9d78db70) at pthread_create.c:304
#12 0xb49eb69e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 9 (Thread 0x9df8eb70 (LWP 2401)):
#0  0xb7fe1424 in __kernel_vsyscall ()
#1  0xb49e4371 in select () at ../sysdeps/unix/syscall-template.S:82
#2  0xa2db4f1c in xine_usec_sleep () from /usr/lib/libxine.so.1
#3  0x00000000 in ?? ()

Thread 8 (Thread 0x9ebcab70 (LWP 2400)):
#0  0xb7fe1424 in __kernel_vsyscall ()
#1  0xb3a3d884 in pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/pthread_cond_timedwait.S:236
#2  0xb49f8df4 in __pthread_cond_timedwait (cond=0x8e56770, mutex=0x8e56758, abstime=0x9ebca1a0) at forward.c:152
#3  0xa2d88b3f in ?? () from /usr/lib/libxine.so.1
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Thread 7 (Thread 0xa56e2b70 (LWP 2391)):
#0  0xb7fe1424 in __kernel_vsyscall ()
#1  0xb49dcdf6 in __poll (fds=0xb4a73ff4, nfds=2, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:87
#2  0xb38a7a1b in g_poll () from /lib/libglib-2.0.so.0
#3  0xb389a43c in ?? () from /lib/libglib-2.0.so.0
#4  0xb389a848 in g_main_context_iteration () from /lib/libglib-2.0.so.0
#5  0xb4eaa565 in QEventDispatcherGlib::processEvents (this=0x8886da8, flags=...) at kernel/qeventdispatcher_glib.cpp:415
#6  0xb4e7a609 in QEventLoop::processEvents (this=0xa56e2110, flags=DWARF-2 expression error: DW_OP_reg operations must be used either alone or in conjuction with DW_OP_piece or DW_OP_bit_piece.
) at kernel/qeventloop.cpp:149
#7  0xb4e7aa8a in QEventLoop::exec (this=0xa56e2110, flags=...) at kernel/qeventloop.cpp:201
#8  0xb4d76b7e in QThread::exec (this=0x8c72da8) at thread/qthread.cpp:490
#9  0xb4e5935b in QInotifyFileSystemWatcherEngine::run (this=0x8c72da8) at io/qfilesystemwatcher_inotify.cpp:248
#10 0xb4d79df9 in QThreadPrivate::start (arg=0x8c72da8) at thread/qthread_unix.cpp:266
#11 0xb3a38cc9 in start_thread (arg=0xa56e2b70) at pthread_create.c:304
#12 0xb49eb69e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 6 (Thread 0xabadbb70 (LWP 2390)):
#0  0xb7fe1424 in __kernel_vsyscall ()
#1  0xb3a3d4dc in pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/pthread_cond_wait.S:169
#2  0xb49f8d9d in __pthread_cond_wait (cond=0x86df500, mutex=0x86df4e8) at forward.c:139
#3  0xb4d7a9c7 in wait (this=0x88c87c0, mutex=0x88c87bc, time=4294967295) at thread/qwaitcondition_unix.cpp:88
#4  QWaitCondition::wait (this=0x88c87c0, mutex=0x88c87bc, time=4294967295) at thread/qwaitcondition_unix.cpp:160
#5  0xb6d8cbba in Digikam::ParkingThread::run (this=0x88c87b0) at /home/amanda/kde/tools/src/digikam/core/libs/threads/threadmanager.cpp:119
#6  0xb4d79df9 in QThreadPrivate::start (arg=0x88c87b0) at thread/qthread_unix.cpp:266
#7  0xb3a38cc9 in start_thread (arg=0xabadbb70) at pthread_create.c:304
#8  0xb49eb69e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 4 (Thread 0xac2dcb70 (LWP 2384)):
#0  0xb7fe1424 in __kernel_vsyscall ()
#1  0xb49dcdf6 in __poll (fds=0xb4a73ff4, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:87
#2  0xb38a7a1b in g_poll () from /lib/libglib-2.0.so.0
#3  0xb389a43c in ?? () from /lib/libglib-2.0.so.0
#4  0xb389a848 in g_main_context_iteration () from /lib/libglib-2.0.so.0
#5  0xb4eaa565 in QEventDispatcherGlib::processEvents (this=0x865e880, flags=...) at kernel/qeventdispatcher_glib.cpp:415
#6  0xb4e7a609 in QEventLoop::processEvents (this=0xac2dc130, flags=DWARF-2 expression error: DW_OP_reg operations must be used either alone or in conjuction with DW_OP_piece or DW_OP_bit_piece.
) at kernel/qeventloop.cpp:149
#7  0xb4e7aa8a in QEventLoop::exec (this=0xac2dc130, flags=...) at kernel/qeventloop.cpp:201
#8  0xb4d76b7e in QThread::exec (this=0x8689c50) at thread/qthread.cpp:490
#9  0xb46b4171 in Herqq::Upnp::HControlPointThread::run() () from /usr/lib/libHUpnp.so.0
#10 0xb4d79df9 in QThreadPrivate::start (arg=0x8689c50) at thread/qthread_unix.cpp:266
#11 0xb3a38cc9 in start_thread (arg=0xac2dcb70) at pthread_create.c:304
#12 0xb49eb69e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 3 (Thread 0xacae7b70 (LWP 2383)):
#0  0xb7fe1424 in __kernel_vsyscall ()
#1  0xb49dcdf6 in __poll (fds=0xb4a73ff4, nfds=2, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:87
#2  0xb38a7a1b in g_poll () from /lib/libglib-2.0.so.0
#3  0xb389a43c in ?? () from /lib/libglib-2.0.so.0
#4  0xb389a848 in g_main_context_iteration () from /lib/libglib-2.0.so.0
#5  0xb4eaa565 in QEventDispatcherGlib::processEvents (this=0x8631570, flags=...) at kernel/qeventdispatcher_glib.cpp:415
#6  0xb4e7a609 in QEventLoop::processEvents (this=0xacae7110, flags=DWARF-2 expression error: DW_OP_reg operations must be used either alone or in conjuction with DW_OP_piece or DW_OP_bit_piece.
) at kernel/qeventloop.cpp:149
#7  0xb4e7aa8a in QEventLoop::exec (this=0xacae7110, flags=...) at kernel/qeventloop.cpp:201
#8  0xb4d76b7e in QThread::exec (this=0x8676e28) at thread/qthread.cpp:490
#9  0xb4e5935b in QInotifyFileSystemWatcherEngine::run (this=0x8676e28) at io/qfilesystemwatcher_inotify.cpp:248
#10 0xb4d79df9 in QThreadPrivate::start (arg=0x8676e28) at thread/qthread_unix.cpp:266
#11 0xb3a38cc9 in start_thread (arg=0xacae7b70) at pthread_create.c:304
#12 0xb49eb69e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 2 (Thread 0xad2e8b70 (LWP 2382)):
#0  0xb7fe1424 in __kernel_vsyscall ()
#1  0xb3a3d4dc in pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/pthread_cond_wait.S:169
#2  0xb49f8d9d in __pthread_cond_wait (cond=0x8661d08, mutex=0x8661cf0) at forward.c:139
#3  0xb4d7a9c7 in wait (this=0x869248c, mutex=0x8692488, time=4294967295) at thread/qwaitcondition_unix.cpp:88
#4  QWaitCondition::wait (this=0x869248c, mutex=0x8692488, time=4294967295) at thread/qwaitcondition_unix.cpp:160
#5  0x082a9539 in Digikam::ScanController::run (this=0x8631700) at /home/amanda/kde/tools/src/digikam/core/digikam/scancontroller.cpp:599
#6  0xb4d79df9 in QThreadPrivate::start (arg=0x8631700) at thread/qthread_unix.cpp:266
#7  0xb3a38cc9 in start_thread (arg=0xad2e8b70) at pthread_create.c:304
#8  0xb49eb69e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 1 (Thread 0xaf79eac0 (LWP 2352)):
#0  0xb7fe1424 in __kernel_vsyscall ()
#1  0xb49dcdf6 in __poll (fds=0xb4a73ff4, nfds=13, timeout=19) at ../sysdeps/unix/sysv/linux/poll.c:87
#2  0xb38a7a1b in g_poll () from /lib/libglib-2.0.so.0
#3  0xb389a43c in ?? () from /lib/libglib-2.0.so.0
#4  0xb389a848 in g_main_context_iteration () from /lib/libglib-2.0.so.0
#5  0xb4eaa565 in QEventDispatcherGlib::processEvents (this=0x85c4e58, flags=...) at kernel/qeventdispatcher_glib.cpp:415
#6  0xb549cbe5 in QGuiEventDispatcherGlib::processEvents (this=0x85c4e58, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#7  0xb4e7a609 in QEventLoop::processEvents (this=0xbfffee04, flags=DWARF-2 expression error: DW_OP_reg operations must be used either alone or in conjuction with DW_OP_piece or DW_OP_bit_piece.
) at kernel/qeventloop.cpp:149
#8  0xb4e7aa8a in QEventLoop::exec (this=0xbfffee04, flags=...) at kernel/qeventloop.cpp:201
#9  0xb4e7f00f in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1009
#10 0xb53d9e07 in QApplication::exec () at kernel/qapplication.cpp:3672
#11 0x0831bb6b in main (argc=1, argv=0xbffff1b4) at /home/amanda/kde/tools/src/digikam/core/digikam/main.cpp:232
Comment 1 caulier.gilles 2011-01-16 09:07:51 UTC
Can you generate a new backtrace because the is not digiKam crash hander entry here.

Thanks in advance

Gilles Caulier
Comment 2 Andrew Coles 2011-01-16 15:32:38 UTC
Oddly, the bug occurred for five or six of my folders containing videos last night, before reporting the bug; now I can't force it to happen at all.  Will post a backtrace as soon as it happens again.
Comment 3 Andrew Coles 2011-01-16 23:36:58 UTC
Okay I have a set of photos and videos which trigger the crash every time, so I've been able to do some more testing.

1) If I run digikam as-is, it crashes part-way through face-recognition, printing out:

pure virtual method called
terminate called without an active exception
Unable to start Dr. Konqi

2) If I run it through gdb, it gives the backtrace I gave when reporting the bug.

3) If I run it through valgrind, I get the output at the bottom of this comment.

If there's anything else that would be helpful, let me know.

==3498== Thread 18:
==3498== Invalid read of size 4
==3498==    at 0x532ECD9: Digikam::LoadingCache::notifyNewLoadingProcess(Digikam::LoadingProcess*, Digikam::LoadingDescription) (loadingcache.cpp:171)
==3498==    by 0x53394AC: Digikam::PreviewLoadingTask::execute() (previewtask.cpp:171)
==3498==    by 0x5320BD2: Digikam::LoadSaveThread::run() (loadsavethread.cpp:116)
==3498==    by 0x536E8ED: Digikam::DynamicThread::DynamicThreadPriv::run() (dynamicthread.cpp:324)
==3498==    by 0x70B0522: QThreadPoolThread::run() (qthreadpool.cpp:106)
==3498==    by 0x70BBDF8: QThreadPrivate::start(void*) (qthread_unix.cpp:266)
==3498==    by 0x92D4CC8: start_thread (pthread_create.c:304)
==3498==    by 0x766269D: clone (clone.S:130)
==3498==  Address 0x27eaa4c0 is 344 bytes inside a block of size 700 free'd
==3498==    at 0x4025504: operator delete(void*) (vg_replace_malloc.c:387)
==3498==    by 0x533A768: Digikam::PreviewLoadingTask::~PreviewLoadingTask() (previewtask.h:40)
==3498==    by 0x5320B0E: Digikam::LoadSaveThread::run() (loadsavethread.cpp:94)
==3498==    by 0x536E8ED: Digikam::DynamicThread::DynamicThreadPriv::run() (dynamicthread.cpp:324)
==3498==    by 0x70B0522: QThreadPoolThread::run() (qthreadpool.cpp:106)
==3498==    by 0x70BBDF8: QThreadPrivate::start(void*) (qthread_unix.cpp:266)
==3498==    by 0x92D4CC8: start_thread (pthread_create.c:304)
==3498==    by 0x766269D: clone (clone.S:130)
==3498== 
pure virtual method called
==3498== Thread 16:
==3498== Invalid read of size 1
==3498==    at 0x5338B23: Digikam::PreviewLoadingTask::execute() (previewtask.cpp:219)
==3498==    by 0x5320BD2: Digikam::LoadSaveThread::run() (loadsavethread.cpp:116)
==3498==    by 0x536E8ED: Digikam::DynamicThread::DynamicThreadPriv::run() (dynamicthread.cpp:324)
==3498==    by 0x70B0522: QThreadPoolThread::run() (qthreadpool.cpp:106)
==3498==    by 0x70BBDF8: QThreadPrivate::start(void*) (qthread_unix.cpp:266)
==3498==    by 0x92D4CC8: start_thread (pthread_create.c:304)
==3498==    by 0x766269D: clone (clone.S:130)
==3498==  Address 0x27eaa49c is 308 bytes inside a block of size 700 free'd
==3498==    at 0x4025504: operator delete(void*) (vg_replace_malloc.c:387)
==3498==    by 0x533A768: Digikam::PreviewLoadingTask::~PreviewLoadingTask() (previewtask.h:40)
==3498==    by 0x5320B0E: Digikam::LoadSaveThread::run() (loadsavethread.cpp:94)
==3498==    by 0x536E8ED: Digikam::DynamicThread::DynamicThreadPriv::run() (dynamicthread.cpp:324)
==3498==    by 0x70B0522: QThreadPoolThread::run() (qthreadpool.cpp:106)
==3498==    by 0x70BBDF8: QThreadPrivate::start(void*) (qthread_unix.cpp:266)
==3498==    by 0x92D4CC8: start_thread (pthread_create.c:304)
==3498==    by 0x766269D: clone (clone.S:130)
==3498== 
==3498== Invalid read of size 4
==3498==    at 0x53399DB: Digikam::PreviewLoadingTask::execute() (previewtask.cpp:247)
==3498==    by 0x5320BD2: Digikam::LoadSaveThread::run() (loadsavethread.cpp:116)
==3498==    by 0x536E8ED: Digikam::DynamicThread::DynamicThreadPriv::run() (dynamicthread.cpp:324)
==3498==    by 0x70B0522: QThreadPoolThread::run() (qthreadpool.cpp:106)
==3498==    by 0x70BBDF8: QThreadPrivate::start(void*) (qthread_unix.cpp:266)
==3498==    by 0x92D4CC8: start_thread (pthread_create.c:304)
==3498==    by 0x766269D: clone (clone.S:130)
==3498==  Address 0x27eaa368 is 0 bytes inside a block of size 700 free'd
==3498==    at 0x4025504: operator delete(void*) (vg_replace_malloc.c:387)
==3498==    by 0x533A768: Digikam::PreviewLoadingTask::~PreviewLoadingTask() (previewtask.h:40)
==3498==    by 0x5320B0E: Digikam::LoadSaveThread::run() (loadsavethread.cpp:94)
==3498==    by 0x536E8ED: Digikam::DynamicThread::DynamicThreadPriv::run() (dynamicthread.cpp:324)
==3498==    by 0x70B0522: QThreadPoolThread::run() (qthreadpool.cpp:106)
==3498==    by 0x70BBDF8: QThreadPrivate::start(void*) (qthread_unix.cpp:266)
==3498==    by 0x92D4CC8: start_thread (pthread_create.c:304)
==3498==    by 0x766269D: clone (clone.S:130)
==3498== 
==3498== Invalid read of size 4
==3498==    at 0x54CD68B: ??? (in /home/amanda/tools/lib/libdigikamcore.so.2.0.0)
==3498==    by 0x5320BD2: Digikam::LoadSaveThread::run() (loadsavethread.cpp:116)
==3498==    by 0x536E8ED: Digikam::DynamicThread::DynamicThreadPriv::run() (dynamicthread.cpp:324)
==3498==    by 0x70B0522: QThreadPoolThread::run() (qthreadpool.cpp:106)
==3498==    by 0x70BBDF8: QThreadPrivate::start(void*) (qthread_unix.cpp:266)
==3498==    by 0x92D4CC8: start_thread (pthread_create.c:304)
==3498==    by 0x766269D: clone (clone.S:130)
==3498==  Address 0x68 is not stack'd, malloc'd or (recently) free'd
==3498== 
KCrash: Application 'digikam' crashing...
KCrash: Attempting to start /usr/lib/kde4/libexec/drkonqi from kdeinit
digikam: Fatal IO error: client killed
QSocketNotifier: Invalid socket 17 and type 'Read', disabling...
terminate called without an active exception
sock_file=/home/amanda/.kde/socket-AmandaVaio/kdeinit4__0
==3498== Thread 3:
==3498== Invalid read of size 2
==3498==    at 0x71ECA05: socketNotifierSourceCheck(_GSource*) (qeventdispatcher_glib.cpp:92)
==3498==    by 0x941FB38: g_main_context_check (in /lib/libglib-2.0.so.0.2600.1)
==3498==    by 0x942045D: ??? (in /lib/libglib-2.0.so.0.2600.1)
==3498==    by 0x9420847: g_main_context_iteration (in /lib/libglib-2.0.so.0.2600.1)
==3498==    by 0x71EC564: QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (qeventdispatcher_glib.cpp:415)
==3498==    by 0x71BC608: QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (qeventloop.cpp:149)
==3498==    by 0x71BCA89: QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (qeventloop.cpp:201)
==3498==    by 0x70B8B7D: QThread::exec() (qthread.cpp:490)
==3498==    by 0x719B35A: QInotifyFileSystemWatcherEngine::run() (qfilesystemwatcher_inotify.cpp:248)
==3498==    by 0x70BBDF8: QThreadPrivate::start(void*) (qthread_unix.cpp:266)
==3498==    by 0x92D4CC8: start_thread (pthread_create.c:304)
==3498==    by 0x766269D: clone (clone.S:130)
==3498==  Address 0xe4dda6e is 6 bytes inside a block of size 12 free'd
==3498==    at 0x4025504: operator delete(void*) (vg_replace_malloc.c:387)
==3498==    by 0x71ED0B4: QEventDispatcherGlib::unregisterSocketNotifier(QSocketNotifier*) (qeventdispatcher_glib.cpp:496)
==3498==    by 0x71DB1D9: QSocketNotifier::setEnabled(bool) (qsocketnotifier.cpp:298)
==3498==    by 0x71ECA01: socketNotifierSourceCheck(_GSource*) (qeventdispatcher_glib.cpp:92)
==3498==    by 0x941FB38: g_main_context_check (in /lib/libglib-2.0.so.0.2600.1)
==3498==    by 0x942045D: ??? (in /lib/libglib-2.0.so.0.2600.1)
==3498==    by 0x9420847: g_main_context_iteration (in /lib/libglib-2.0.so.0.2600.1)
==3498==    by 0x71EC564: QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (qeventdispatcher_glib.cpp:415)
==3498==    by 0x71BC608: QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (qeventloop.cpp:149)
==3498==    by 0x71BCA89: QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (qeventloop.cpp:201)
==3498==    by 0x70B8B7D: QThread::exec() (qthread.cpp:490)
==3498==    by 0x719B35A: QInotifyFileSystemWatcherEngine::run() (qfilesystemwatcher_inotify.cpp:248)
==3498== 
==3498== Invalid read of size 2
==3498==    at 0x71ECA09: socketNotifierSourceCheck(_GSource*) (qeventdispatcher_glib.cpp:83)
==3498==    by 0x941FB38: g_main_context_check (in /lib/libglib-2.0.so.0.2600.1)
==3498==    by 0x942045D: ??? (in /lib/libglib-2.0.so.0.2600.1)
==3498==    by 0x9420847: g_main_context_iteration (in /lib/libglib-2.0.so.0.2600.1)
==3498==    by 0x71EC564: QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (qeventdispatcher_glib.cpp:415)
==3498==    by 0x71BC608: QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (qeventloop.cpp:149)
==3498==    by 0x71BCA89: QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (qeventloop.cpp:201)
==3498==    by 0x70B8B7D: QThread::exec() (qthread.cpp:490)
==3498==    by 0x719B35A: QInotifyFileSystemWatcherEngine::run() (qfilesystemwatcher_inotify.cpp:248)
==3498==    by 0x70BBDF8: QThreadPrivate::start(void*) (qthread_unix.cpp:266)
==3498==    by 0x92D4CC8: start_thread (pthread_create.c:304)
==3498==    by 0x766269D: clone (clone.S:130)
==3498==  Address 0xe4dda6c is 4 bytes inside a block of size 12 free'd
==3498==    at 0x4025504: operator delete(void*) (vg_replace_malloc.c:387)
==3498==    by 0x71ED0B4: QEventDispatcherGlib::unregisterSocketNotifier(QSocketNotifier*) (qeventdispatcher_glib.cpp:496)
==3498==    by 0x71DB1D9: QSocketNotifier::setEnabled(bool) (qsocketnotifier.cpp:298)
==3498==    by 0x71ECA01: socketNotifierSourceCheck(_GSource*) (qeventdispatcher_glib.cpp:92)
==3498==    by 0x941FB38: g_main_context_check (in /lib/libglib-2.0.so.0.2600.1)
==3498==    by 0x942045D: ??? (in /lib/libglib-2.0.so.0.2600.1)
==3498==    by 0x9420847: g_main_context_iteration (in /lib/libglib-2.0.so.0.2600.1)
==3498==    by 0x71EC564: QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (qeventdispatcher_glib.cpp:415)
==3498==    by 0x71BC608: QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (qeventloop.cpp:149)
==3498==    by 0x71BCA89: QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (qeventloop.cpp:201)
==3498==    by 0x70B8B7D: QThread::exec() (qthread.cpp:490)
==3498==    by 0x719B35A: QInotifyFileSystemWatcherEngine::run() (qfilesystemwatcher_inotify.cpp:248)
==3498== 
QSocketNotifier: Invalid socket 30 and type 'Read', disabling...
Unable to start Dr. Konqi
Comment 4 Marcel Wiesweg 2011-01-17 17:06:18 UTC
Can you provide one of those files?
To be sure it's really the file and not the context, try if such a file scanned in a different folder or a folder for itself also triggers the crash.

It would be immensely helpful if I could reproduce!

I assume you are using current SVN?
Comment 5 Andrew Coles 2011-01-17 22:53:29 UTC
It seems to be caused by having a directory with interleaved video and photo files.  If the videos are all listed at the end of the directory, it passes over them quickly then declares that face recognition has finished.  But, if it has to switch back and forth, between pictures it can load previews for and ones it cannot, it crashes.

I can give you the test album I'm using, though it's 100Mb.  It's nothing special, just a few JPGs, then a few AVIs, then a few JPGs, then a few AVIs. etc

(And yes, I'm using the latest SVN.)

MfG, Andrew
Comment 6 Marcel Wiesweg 2011-01-18 00:33:33 UTC
I'm currently at a slow internet connection, this will have to wait until next week. I will see to prepare such a folder.
Comment 7 Andrew Coles 2011-01-18 13:16:05 UTC
Okay, some more hunting - I'm trying to see if I can work out what's going on here.  Adding some debugging messages I get:

* Started to execute PreviewLoadingTask (LoadingProcess 0xc3bd2b8)
* Called LoadingCache::addLoadingProcess(0xc3bd2b8) for image /home/amanda/Pictures/Test/aa056.jpg-previewImage-1600
...
* Destroying LoadingProcess at 0xc3bd2b8

So, a PreviewLoadingTask is started, and then destroyed *before it has finished executing* and hence called LoadingCache::removeLoadingProcess.

The crash itself arises when another PreviewLoadingTask is started:

* Called LoadingCache::addLoadingProcess(0xc2dc290) for image /home/amanda/Pictures/Test/aa057.jpg-previewImage-1600
* In LoadingCache::notifyNewLoadingProcess: notifying 0xc3bd2b8

...which attempts to call use the PreviewLoadingTask deleted above.

So it's nothing to do with face recognition; just that face recognition stress-tests the multi-threaded image previewing code.
Comment 8 Andrew Coles 2011-01-18 19:36:48 UTC
Some more detective with: the problem is caused by two threads, running at the same time, calling LoadSaveThread::run() on the same LoadSaveThread object - and hence sharing the same memory location for m_currentTask.  Thus:

  i) Thread A sets m_currentTask to a PreviewLoadingTask foo, and calls execute

 ii) Thread B starts, deleting m_currentTask (i.e. foo), sets m_currentTask to a different PreviewLoadingTask, calls execute

iii) As part of PreviewLoadingTask::execute(), thread B calls notifyNewLoadingProcess, which tries to call notifyNewLoadingProcess on foo - which has since been deleted.

Its step (iii) which leads to the error 'pure virtual method called', but the problem is somewhere in the code the same LoadSaveThread object is being used as the basis of two executing threads.

I'll carry on working backwards, see if I can work out where that is.
Comment 9 Marcel Wiesweg 2011-01-19 00:23:44 UTC
Ah. Damn, still this problem!!
I have seen this in a few occasions, and fixed some loopholes, see also 261779. There must be something left. It's libs/threads/dynamicthreads.cpp.

There is the d->threadRequested safeguard (mutex protected) to avoid requesting a thread twice from the pool. Additionally, transitionToRunning() (mutex protected) should return false for a second thread, avoiding to call q->run in ::run(). I must miss something, but I dont know where.
Comment 10 Andrew Coles 2011-01-22 12:42:19 UTC
Created attachment 56312 [details]
Patch to stop the same DynamicThread::run() function being called twice in parallel

Okay, I think I've cracked this now.  In DynamicThread::DynamicThreadPriv::run() it used to do:

takingThread();  // change threadRequested to 'false', allowing this DynamicThreadPriv to be scheduled again

if (emitSignals)
{
    emit q->started();
}

if (transitionToRunning()) // if the DynamicThread was not running, mark it as running (change the value of the variable state from Scheduled to Running)
{
    q->run(); // ...then actually call the run function
}

The problem seems to be the gap, between:

i) threadRequested being set to false
ii) state being changed from Scheduled set to Running.

On some executions of the program, between (i) and (ii) another copy of the DynamicThreadPriv was scheduled and started.  Then, both managed to make the transition to running, and q->run() was called twice at the same time on the same q.

A solution, as far as I can tell, is to move the call to takingThread() lower down:

if (emitSignals)
{
    emit q->started();
}

if (transitionToRunning())
{        
    takingThread();                
    q->run();
}
else
{
    takingThread();                
}

Now, there is no longer the (i)-(ii) gap discussed above: the variable threadRequested is only set to false once the variable state records that the thread is now running (or in the case of the else, once it has been safely determined that the transition to running did not occur).

Patch attached: shall I commit or do you want to handle it?
Comment 11 Marcel Wiesweg 2011-01-22 14:17:19 UTC
Thanks a lot! Looking back, it's plain obvious, but I really didnt see that at first glance.

We could also just remove the takingThread method and change the threadRequested flag in the second line of transitionToRunning I think.

Please go forward and commit as you like.
Comment 12 Andrew Coles 2011-01-22 16:53:52 UTC
SVN commit 1216303 by coles:

Moved the call to takingThread() so it definitely comes after the value of the
the variable 'state' is updated in transitionToRunning().  This avoids two
instances of the same DynamicThreadPriv being scheduled at the same time.

BUG: 263272

M  +5 -2      dynamicthread.cpp

WebSVN link: http://websvn.kde.org/?view=rev&revision=1216303