Bug 255054

Summary: Crash during picture import [KDirWatch::contains, Digikam::AlbumManager::addAlbumRoot, Digikam::AlbumManager::slotCollectionLocationStatusChanged]
Product: [Applications] digikam Reporter: Gareth <gareth.glaccum>
Component: Database-AlbumsAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: andresbajotierra, caulier.gilles, cfeck, dreibh, kenjarvis, majoky, simon.schaak, stefan.wolmarans
Priority: NOR    
Version: 1.6.0   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In: 1.8.0
Attachments: New crash information added by DrKonqi

Description Gareth 2010-10-23 18:08:58 UTC
Application: digikam (1.6.0 (rev.: 1188955))
KDE Platform Version: 4.5.2 (KDE 4.5.2)
Qt Version: 4.7.0
Operating System: Linux 2.6.35.4-28.fc14.i686 i686
Distribution (Platform): Fedora RPMs

-- Information about the crash:
Trying to get digicam to import Canon CR2 files. 
I selected, Settings, I think, to create a new collection, based on a directory on disk.
The directory contains several thousand CR2, and around 20 MVI, with some TIF.

Almost immediately after creating the collection, and starting to import the photos, the program crashed. 

Digikam was compiled from latest svn, as was libkface, libkmap, marble, libkexiv2, libkdcraw

-- Backtrace:
Application: digiKam (digikam), signal: Segmentation fault
[Current thread is 1 (Thread 0xb78937b0 (LWP 25054))]

Thread 7 (Thread 0xb764cb70 (LWP 25055)):
#0  0x00110416 in __kernel_vsyscall ()
#1  0x087218e6 in poll () from /lib/libc.so.6
#2  0x010ccdac in g_poll (fds=0xb6d029c0, nfds=1, timeout=-1) at gpoll.c:132
#3  0x010bc8b7 in g_main_context_poll (context=0x8a7d9f0, block=1, dispatch=1, self=<value optimized out>) at gmain.c:3093
#4  g_main_context_iterate (context=0x8a7d9f0, block=1, dispatch=1, self=<value optimized out>) at gmain.c:2775
#5  0x010bd04b in g_main_loop_run (loop=0x8a7da70) at gmain.c:2988
#6  0x017cded5 in gdbus_shared_thread_func (data=0x0) at gdbusprivate.c:277
#7  0x010e5bd0 in g_thread_create_proxy (data=0x8a7da80) at gthread.c:1897
#8  0x006f7f19 in start_thread () from /lib/libpthread.so.0
#9  0x0872ca2e in clone () from /lib/libc.so.6

Thread 6 (Thread 0xb02dab70 (LWP 25063)):
#0  0x00110416 in __kernel_vsyscall ()
#1  0x006fc98b in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0x0768a4e7 in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#3  0x009d55fd in Digikam::ParkingThread::run (this=0x8d547d0) at /usr/local/src/digikam/digikam/libs/threads/threadmanager.cpp:101
#4  0x07689dea in ?? () from /usr/lib/libQtCore.so.4
#5  0x006f7f19 in start_thread () from /lib/libpthread.so.0
#6  0x0872ca2e in clone () from /lib/libc.so.6

Thread 5 (Thread 0xafad9b70 (LWP 25064)):
#0  g_main_context_prepare (context=<value optimized out>, priority=0xafad90fc) at gmain.c:2474
#1  0x010bc55b in g_main_context_iterate (context=0x8d84730, block=1, dispatch=1, self=<value optimized out>) at gmain.c:2760
#2  0x010bcc35 in g_main_context_iteration (context=0x8d84730, may_block=1) at gmain.c:2843
#3  0x077af387 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#4  0x077807ca in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#5  0x07780a7a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#6  0x076872eb in QThread::exec() () from /usr/lib/libQtCore.so.4
#7  0x07689dea in ?? () from /usr/lib/libQtCore.so.4
#8  0x006f7f19 in start_thread () from /lib/libpthread.so.0
#9  0x0872ca2e in clone () from /lib/libc.so.6

Thread 4 (Thread 0xaf2d8b70 (LWP 25065)):
#0  0x010bc792 in g_main_context_iterate (context=<value optimized out>, block=) at gmain.c:2789
#1  0x010bcc35 in g_main_context_iteration (context=0xb4514bc0, may_block=1) at gmain.c:2843
#2  0x077af387 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#3  0x077807ca in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#4  0x07780a7a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#5  0x076872eb in QThread::exec() () from /usr/lib/libQtCore.so.4
#6  0x07689dea in ?? () from /usr/lib/libQtCore.so.4
#7  0x006f7f19 in start_thread () from /lib/libpthread.so.0
#8  0x0872ca2e in clone () from /lib/libc.so.6

Thread 3 (Thread 0xa7131b70 (LWP 25079)):
#0  0x00110416 in __kernel_vsyscall ()
#1  0x006fcd33 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0x0613425d in ?? () from /usr/lib/libxine.so.1
#3  0x006f7f19 in start_thread () from /lib/libpthread.so.0
#4  0x0872ca2e in clone () from /lib/libc.so.6

Thread 2 (Thread 0xa5d24b70 (LWP 25081)):
#0  0x00110416 in __kernel_vsyscall ()
#1  0x087218e6 in poll () from /lib/libc.so.6
#2  0x010ccdac in g_poll (fds=0x929db80, nfds=1, timeout=-1) at gpoll.c:132
#3  0x010bc8b7 in g_main_context_poll (context=0x929c4d8, block=1, dispatch=1, self=<value optimized out>) at gmain.c:3093
#4  g_main_context_iterate (context=0x929c4d8, block=1, dispatch=1, self=<value optimized out>) at gmain.c:2775
#5  0x010bcc35 in g_main_context_iteration (context=0x929c4d8, may_block=1) at gmain.c:2843
#6  0x077af387 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#7  0x077807ca in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#8  0x07780a7a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#9  0x076872eb in QThread::exec() () from /usr/lib/libQtCore.so.4
#10 0x0557a2cb in ?? () from /usr/lib/kde4/plugins/phonon_backend/phonon_xine.so
#11 0x07689dea in ?? () from /usr/lib/libQtCore.so.4
#12 0x006f7f19 in start_thread () from /lib/libpthread.so.0
#13 0x0872ca2e in clone () from /lib/libc.so.6

Thread 1 (Thread 0xb78937b0 (LWP 25054)):
[KCrash Handler]
#7  0x024911b3 in KDirWatch::contains(QString const&) const () from /usr/lib/libkdecore.so.5
#8  0x0824a173 in Digikam::AlbumManager::addAlbumRoot (this=0x8befa80, location=...) at /usr/local/src/digikam/digikam/digikam/albummanager.cpp:1131
#9  0x08255749 in Digikam::AlbumManager::slotCollectionLocationStatusChanged (this=0x8befa80, location=..., oldStatus=0) at /usr/local/src/digikam/digikam/digikam/albummanager.cpp:1102
#10 0x082561f7 in Digikam::AlbumManager::qt_metacall (this=0x8befa80, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0xbfd59004) at /usr/local/src/digikam/digikam/digikam/albummanager.moc:185
#11 0x07787e3b in QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib/libQtCore.so.4
#12 0x07797327 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#13 0x001ebb19 in Digikam::CollectionManager::locationStatusChanged (this=0x8bee160, _t1=..., _t2=0) at /usr/local/src/digikam/digikam/digikam/collectionmanager.moc:108
#14 0x001f396d in Digikam::CollectionManager::updateLocations (this=0x8bee160) at /usr/local/src/digikam/digikam/libs/database/collectionmanager.cpp:1376
#15 0x001f47fd in Digikam::CollectionManager::slotAlbumRootChange (this=0x8bee160, changeset=...) at /usr/local/src/digikam/digikam/libs/database/collectionmanager.cpp:1406
#16 0x001f4c55 in Digikam::CollectionManager::qt_metacall (this=0x8bee160, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0xbfd59328) at /usr/local/src/digikam/digikam/digikam/collectionmanager.moc:95
#17 0x07787e3b in QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib/libQtCore.so.4
#18 0x07797327 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#19 0x001fb003 in Digikam::DatabaseWatch::albumRootChange (this=0x8c04d98, _t1=...) at /usr/local/src/digikam/digikam/digikam/moc_databasewatch.cpp:185
#20 0x001fbe98 in Digikam::DatabaseWatch::slotAlbumRootChangeDBus (this=0x8c04d98, databaseIdentifier=..., applicationIdentifier=..., changeset=...) at /usr/local/src/digikam/digikam/libs/database/databasewatch.cpp:334
#21 0x001fbfdb in Digikam::DatabaseWatch::qt_metacall (this=0x8c04d98, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0xbfd5949c) at /usr/local/src/digikam/digikam/digikam/moc_databasewatch.cpp:137
#22 0x00422b55 in ?? () from /usr/lib/libQtDBus.so.4
#23 0x0042e3e8 in ?? () from /usr/lib/libQtDBus.so.4
#24 0x07796e2f in QObject::event(QEvent*) () from /usr/lib/libQtCore.so.4
#25 0x027aecbc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#26 0x027b3852 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#27 0x03383dab in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#28 0x07781633 in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#29 0x07785355 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/libQtCore.so.4
#30 0x0778552e in QCoreApplication::sendPostedEvents(QObject*, int) () from /usr/lib/libQtCore.so.4
#31 0x077af1d5 in ?? () from /usr/lib/libQtCore.so.4
#32 0x010bc192 in g_main_dispatch (context=0x8a49e90) at gmain.c:2149
#33 g_main_context_dispatch (context=0x8a49e90) at gmain.c:2702
#34 0x010bc978 in g_main_context_iterate (context=0x8a49e90, block=1, dispatch=1, self=<value optimized out>) at gmain.c:2780
#35 0x010bcc35 in g_main_context_iteration (context=0x8a49e90, may_block=1) at gmain.c:2843
#36 0x077af34d in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#37 0x02860a46 in ?? () from /usr/lib/libQtGui.so.4
#38 0x077807ca in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#39 0x07780a7a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#40 0x077855f7 in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#41 0x027acaf8 in QApplication::exec() () from /usr/lib/libQtGui.so.4
#42 0x08359e2b in main (argc=565622, argv=0xb8000000) at /usr/local/src/digikam/digikam/digikam/main.cpp:195

Reported using DrKonqi
Comment 1 caulier.gilles 2010-10-23 18:32:06 UTC
Problem already reported in the past. It's KDELibs crash.

Gilles Caulier
Comment 2 caulier.gilles 2010-10-23 18:33:47 UTC

*** This bug has been marked as a duplicate of bug 222974 ***
Comment 3 Gareth 2010-10-23 18:40:48 UTC
According to the other bug report, this appears to have been put into kdelib 4.4.1? The system I am running reports kdelibs as being 4.5.2
Is it possible that it was linked to the wrong bug?
Comment 4 caulier.gilles 2010-10-23 18:45:24 UTC
The crash is in KDirWatch API, not digiKam...

Gilles Caulier
Comment 5 Christoph Feck 2010-10-23 19:01:07 UTC
Gilles, the crash is completely different to the old (common) KDirWatch crash. I doubt the problem is in kdelibs. Could you check if it is possible you are not calling with a valid KDirWatch object? The contains() function is quite simple, it probably only crashes on invalid input.
Comment 6 caulier.gilles 2010-10-23 19:06:13 UTC
No. Crash appear in KDELIbs :

Thread 1 (Thread 0xb78937b0 (LWP 25054)):
[KCrash Handler]
#7  0x024911b3 in KDirWatch::contains(QString const&) const () from
/usr/lib/libkdecore.so.5
#8  0x0824a173 in Digikam::AlbumManager::addAlbumRoot (this=0x8befa80,
location=...) at /usr/local/src/digikam/digikam/digikam/albummanager.cpp:1131
#9  0x08255749 in Digikam::AlbumManager::slotCollectionLocationStatusChanged

digiKam register KDirWatch component to query which file have been added during import. This is used to scan new items in digiKam DB. The problem with KDirwatch is not a new stuff...

Gilles Caulier
Comment 7 Christoph Feck 2010-10-23 19:24:18 UTC
I searched bugzilla for "KDirWatch::contains" and only found the issue in KDevelop CMake handling. Other than that, there has never been a crash in that function. It certainly isn't an old problem :)
Comment 8 Christoph Feck 2010-11-15 02:08:27 UTC
Seeing that you are calling with an invalid KDirWatch object in bug 256867, I think you should check here, too.
Comment 9 Marcel Wiesweg 2010-11-15 10:14:54 UTC
*** Bug 256867 has been marked as a duplicate of this bug. ***
Comment 10 Marcel Wiesweg 2010-11-15 10:29:08 UTC
There is a situation in setDatabase where the dirwatch is null for some time. I dont know the exact problem, but there is a pattern to these backtraces
Comment 11 Marcel Wiesweg 2010-11-15 10:32:59 UTC
SVN commit 1197259 by mwiesweg:

Dont delete the dir watch to clear it, just keep it and store the added
directories to explicitly remove them. Object is deleted by QObject destructor
at shutdown.
Should prevent any situation where d->dirwatch is 0.

CCBUG: 255054

 M  +11 -10    albummanager.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1197259
Comment 12 caulier.gilles 2010-11-15 14:21:51 UTC
Gareth,

svn trunk is patched by MArcel. Please compile/install and test this code.

Thanks in advance

Gilles Caulier
Comment 13 caulier.gilles 2010-11-24 09:13:13 UTC
digiKam 1.6.0 is out:

http://www.digikam.org/drupal/node/550

Please update and check if this entry still valid.

Thanks in advance

Gilles Caulier
Comment 14 caulier.gilles 2010-11-26 18:45:17 UTC
*** Bug 258002 has been marked as a duplicate of this bug. ***
Comment 15 caulier.gilles 2010-11-30 22:07:06 UTC
Gareth,

can you test with digiKam 1.6.0 ?

Gilles Caulier
Comment 16 Dario Andres 2010-12-25 15:02:26 UTC
[Comment from a bug triager]
From bug 261228 (Digikam 1.4.0):
- What I was doing when the application crashed:
I plugged a flash drive into the usb port while digikam was running. Instead of
doing nothing, digikam crashed. There were no albums (or anything else related
to digikam) on the flash drive, just two jpg files.
Comment 17 Dario Andres 2010-12-25 15:03:28 UTC
*** Bug 261228 has been marked as a duplicate of this bug. ***
Comment 18 Thomas Dreibholz 2010-12-31 15:34:24 UTC
Created attachment 55418 [details]
New crash information added by DrKonqi

digikam (1.4.0) on KDE Platform 4.5.4 (KDE 4.5.4) using Qt 4.7.0

- What I was doing when the application crashed:

I have clicked on another folder in my Pictures directory, containing about 3000 images not yet previewed by digikam -> digikam started to create previews -> crash.

-- Backtrace (Reduced):
#6  KDirWatch::contains (this=0x0, _path=...) at ../../kdecore/io/kdirwatch.cpp:1830
#7  0x000000000063d598 in Digikam::AlbumManager::addAlbumRoot (this=0x25686b0, location=...) at /build/buildd/digikam-1.4.0/digikam/albummanager.cpp:1131
#8  0x0000000000645ca1 in Digikam::AlbumManager::slotCollectionLocationStatusChanged (this=0x25686b0, location=..., oldStatus=0) at /build/buildd/digikam-1.4.0/digikam/albummanager.cpp:1102
#9  0x0000000000647d75 in Digikam::AlbumManager::qt_metacall (this=0x25686b0, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fff40521970) at /build/buildd/digikam-1.4.0/obj-x86_64-linux-gnu/digikam/albummanager.moc:185
[...]
#11 0x00007fa67d5c6053 in Digikam::CollectionManager::locationStatusChanged (this=0x0, _t1=<value optimized out>, _t2=0) at /build/buildd/digikam-1.4.0/obj-x86_64-linux-gnu/digikam/collectionmanager.moc:108
Comment 19 caulier.gilles 2010-12-31 16:29:58 UTC
This bug have been fixed in recent version of digiKam (>= 1.6.0). you compile 1.4.0. Why ?

Always use last stable version available !

Gilles Caulier
Comment 20 caulier.gilles 2010-12-31 18:55:51 UTC
*** Bug 261740 has been marked as a duplicate of this bug. ***
Comment 21 Marcel Wiesweg 2011-01-18 15:05:00 UTC
I'm pretty confident this is really fixed.