Bug 190593

Summary: DigiKam crashes on start-up
Product: [Applications] digikam Reporter: David Hill <dbhsatx>
Component: DImg-PluginsAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: caulier.gilles, marcel.wiesweg, nuonguy
Priority: NOR    
Version: 0.10.0   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 1.0.0
Sentry Crash Report:

Description David Hill 2009-04-25 05:12:12 UTC
Version:            (using KDE 4.2.2)
OS:                Linux
Installed from:    Ubuntu Packages

On start DigiKam the splash screen displays "scanning images in individual albums". After aproximintly 45 seconds a crash screen appears with,

The application digiKam (digikam) crashed and caused the signal 6 (SIGABRT).

When I click the details check box this is the output,

This backtrace appears to be of no use.
This is probably because your packages are built in a way which prevents creation of proper backtraces, or the stack frame was seriously corrupted in the crash.

Ran DigiKam from terminal and this was the output,

david@fam-lpt:~$ digikam
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
KCrash: Application 'digikam' crashing...
QSocketNotifier: Invalid socket 10 and type 'Read', disabling...
QSocketNotifier: Invalid socket 12 and type 'Read', disabling...
digikam: Fatal IO error: client killed
sock_file=/home/david/.kde/socket-fam-lpt/kdeinit4__0
Alarm clock
david@fam-lpt:~$

This problem occured on Kubuntu 9.04 beta. Did a clean install of Kubuntu 9.04 release and downloaded & complied DigiKam before loading any other software. DigiKam worked fine. I was able to connect to my digital camera and load pictures to the computer. Later, loaded a large collection of pictures (2 gig) from backup to default picture folder. Downloaded and compiled the R5U87X webcam module from http://bitbucket.org/ahixon/r5u87x/ (the only to get the webcam working on Sony Vaio VGN FZ460E computer). Downloaded and installed Skype to verify the webcam was working. Started Amarok to verify and load music collection. 

When I started DigiKam I received the above error same as with the 9.04 beta.
Comment 1 David Hill 2009-04-25 08:40:36 UTC
Edit 1:
Had also loaded Nvidia restricted drivers so I tried disabling. Same result as before.

Loaded debugging symbols with package manager. Here is the result

Application: digiKam (digikam), signal SIGABRT
[Current thread is 0 (LWP 5233)]

Thread 2 (Thread 0xb3156b90 (LWP 5234)):
[KCrash Handler]
#6  0xb7fed430 in __kernel_vsyscall ()
#7  0xb54796d0 in raise () from /lib/tls/i686/cmov/libc.so.6
#8  0xb547b098 in abort () from /lib/tls/i686/cmov/libc.so.6
#9  0xb56a38f8 in __gnu_cxx::__verbose_terminate_handler () from /usr/lib/libstdc++.so.6
#10 0xb56a17d5 in ?? () from /usr/lib/libstdc++.so.6
#11 0xb56a1812 in std::terminate () from /usr/lib/libstdc++.so.6
#12 0xb56a194a in __cxa_throw () from /usr/lib/libstdc++.so.6
#13 0xb56a1fa3 in operator new () from /usr/lib/libstdc++.so.6
#14 0xb56a208d in operator new[] () from /usr/lib/libstdc++.so.6
#15 0xb719b3eb in Digikam::QImageLoader::load (this=0xb3155cd4, filePath=@0xb3155eb4, observer=0x0) at /build/buildd/digikam-0.10.0/libs/dimg/loaders/qimageloader.cpp:99
#16 0xb717de51 in Digikam::DImg::load (this=0xb3155f34, filePath=@0xb3155eb4, loadFlagsInt=1, observer=0x0, rawDecodingSettings=
          {<KDcrawIface::RawDecodingSettings> = {_vptr.RawDecodingSettings = 0xb3155dc0, gamma16bit = 132, sixteenBitsImage = 200, halfSizeColorImage = 34, whiteBalance = 3037249771, customWhiteBalance = -1215995916, customWhiteBalanceGreen = -4.8617354703699269e-63, RGBInterpolate4Colors = true, DontStretchPixels = false, unclipColors = 6500, RAWQuality = KDcrawIface::RawDecodingSettings::BILINEAR, medianFilterPasses = 1072693248, enableNoiseReduction = false, NRThreshold = 0, enableCACorrection = false, caMultiplier = {-1.2982815000390085e-62, 1.1852782171602882e-264}, brightness = 0, enableBlackPoint = false, blackPoint = 0, enableWhitePoint = false, whitePoint = 1065353216, inputColorSpace = KDcrawIface::RawDecodingSettings::NOINPUTCS, inputProfile = {static null = {<No data fields>}, static shared_null = {ref = {_q_value = 3235}, alloc = 0, size = 0, data = 0x835da52, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, static shared_empty = {ref = {_q_value = 84}, alloc = 0, size = 0, data = 0xb5915a6e, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0x0, static codecForCStrings = 0x0}, outputColorSpace = KDcrawIface::RawDecodingSettings::RAWCOLOR, outputProfile = {static null = {<No data fields>}, static shared_null = {ref = {_q_value = 3235}, alloc = 0, size = 0, data = 0x835da52, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, static shared_empty = {ref = {_q_value = 84}, alloc = 0, size = 0, data = 0xb5915a6e, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0x0, static codecForCStrings = 0x0}, deadPixelMap = {static null = {<No data fields>}, static shared_null = {ref = {_q_value = 3235}, alloc = 0, size = 0, data = 0x835da52, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, static shared_empty = {ref = {_q_value = 84}, alloc = 0, size = 0, data = 0xb5915a6e, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0x0, static codecForCStrings = 0x0}, whiteBalanceArea = {x1 = 137747008, y1 = 1, x2 = 137747008, y2 = 137747008}}, lightness = 0, contrast = -nan(0xfffffffffffff), gamma = 0, saturation = 1, exposureComp = 1, curveAdjust = {<QVector<QPoint>> = {{p = 0x0, d = 0x0}}, <No data fields>}, levelsAdjust = {{p = {static shared_null = {ref = {_q_value = 1786}, alloc = 0, begin = 0, end = 0, sharable = 1, array = {0x0}}, d = 0x3ff00000}, d = 0x3ff00000}}}) at /build/buildd/digikam-0.10.0/libs/dimg/dimg.cpp:447
#17 0xb717fe27 in Digikam::DImg::loadImageInfo (this=0xb3155f34, filePath=@0xb3155eb4, loadMetadata=false, loadICCData=false, loadUniqueHash=false)
    at /build/buildd/digikam-0.10.0/libs/dimg/dimg.cpp:326
#18 0xb702929c in Digikam::ImageScanner::loadFromDisk (this=0xb3155f24) at /build/buildd/digikam-0.10.0/libs/database/imagescanner.cpp:603
#19 0xb7030312 in Digikam::ImageScanner::newFile (this=0xb3155f24, albumId=9) at /build/buildd/digikam-0.10.0/libs/database/imagescanner.cpp:89
#20 0xb70222ba in Digikam::CollectionScanner::scanNewFile (this=0xb3156314, info=@0x91c30d4, albumId=9) at /build/buildd/digikam-0.10.0/libs/database/collectionscanner.cpp:592
#21 0xb702384f in Digikam::CollectionScanner::scanAlbum (this=0xb3156314, location=@0x90d6b28, album=@0xb31561c4) at /build/buildd/digikam-0.10.0/libs/database/collectionscanner.cpp:545
#22 0xb7023758 in Digikam::CollectionScanner::scanAlbum (this=0xb3156314, location=@0x90d6b28, album=@0xb3156244) at /build/buildd/digikam-0.10.0/libs/database/collectionscanner.cpp:556
#23 0xb70242b7 in Digikam::CollectionScanner::scanAlbumRoot (this=0xb3156314, location=@0x90d6b28) at /build/buildd/digikam-0.10.0/libs/database/collectionscanner.cpp:345
#24 0xb702455e in Digikam::CollectionScanner::completeScan (this=0xb3156314) at /build/buildd/digikam-0.10.0/libs/database/collectionscanner.cpp:192
#25 0x0828f2d7 in Digikam::ScanController::run (this=0x8f8d590) at /build/buildd/digikam-0.10.0/digikam/scancontroller.cpp:432
#26 0xb572c96e in QThreadPrivate::start (arg=0x8f8d590) at thread/qthread_unix.cpp:189
#27 0xb543b4ff in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#28 0xb553249e in clone () from /lib/tls/i686/cmov/libc.so.6

Thread 1 (Thread 0xb46e8920 (LWP 5233)):
#0  0xb7fed430 in __kernel_vsyscall ()
#1  0xb543f0e5 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/libpthread.so.0
#2  0xb55412ed in pthread_cond_wait () from /lib/tls/i686/cmov/libc.so.6
#3  0xb572d9b2 in QWaitCondition::wait (this=0x8f98590, mutex=0x8f9857c, time=4294967295) at thread/qwaitcondition_unix.cpp:87
#4  0xb572cb13 in QThread::wait (this=0x8f8d590, time=4294967295) at thread/qthread_unix.cpp:485
#5  0x0828ef1e in Digikam::ScanController::shutDown (this=0x8f8d590) at /build/buildd/digikam-0.10.0/digikam/scancontroller.cpp:264
#6  0x08292671 in ~ScanController (this=0x8f8d590) at /build/buildd/digikam-0.10.0/digikam/scancontroller.cpp:247
#7  0x0829281a in destroy () at /build/buildd/digikam-0.10.0/digikam/scancontroller.cpp:188
#8  0xb547cbb9 in exit () from /lib/tls/i686/cmov/libc.so.6
#9  0xb5d562ab in qt_xio_errhandler () at kernel/qapplication_x11.cpp:707
#10 0xb69162fa in KApplication::xioErrhandler (this=0xbfb0aad4, dpy=0x8eda770) at /build/buildd/kde4libs-4.2.2/kdeui/kernel/kapplication.cpp:413
#11 0xb6916336 in kde_xio_errhandler (dpy=0x8eda770) at /build/buildd/kde4libs-4.2.2/kdeui/kernel/kapplication.cpp:130
#12 0xb52c9f22 in _XIOError () from /usr/lib/libX11.so.6
#13 0xb52d1743 in ?? () from /usr/lib/libX11.so.6
#14 0xb52d20e5 in _XEventsQueued () from /usr/lib/libX11.so.6
#15 0xb52ba7af in XEventsQueued () from /usr/lib/libX11.so.6
#16 0xb5d935bd in x11EventSourceCheck (s=0x8ec79a8) at kernel/qguieventdispatcher_glib.cpp:87
#17 0xb4af96f6 in g_main_context_check () from /usr/lib/libglib-2.0.so.0
#18 0xb4af9fdd in ?? () from /usr/lib/libglib-2.0.so.0
#19 0xb4afa268 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#20 0xb584c438 in QEventDispatcherGlib::processEvents (this=0x8eb05c0, flags={i = -1078941512}) at kernel/qeventdispatcher_glib.cpp:323
#21 0xb5d933f5 in QGuiEventDispatcherGlib::processEvents (this=0x8eb05c0, flags={i = -1078941464}) at kernel/qguieventdispatcher_glib.cpp:202
#22 0xb581f06a in QEventLoop::processEvents (this=0x8f8e8e0, flags={i = -1078941400}) at kernel/qeventloop.cpp:149
#23 0xb581f4aa in QEventLoop::exec (this=0x8f8e8e0, flags={i = -1078941348}) at kernel/qeventloop.cpp:200
#24 0x0828ed93 in Digikam::ScanController::completeCollectionScan (this=0x8f8d590, splash=0x90d2710) at /build/buildd/digikam-0.10.0/digikam/scancontroller.cpp:326
#25 0x08252a9a in DigikamApp (this=0x8fcc6b8) at /build/buildd/digikam-0.10.0/digikam/digikamapp.cpp:164
#26 0x082b4be4 in main (argc=5, argv=0xbfb0ad34) at /build/buildd/digikam-0.10.0/digikam/main.cpp:167
Comment 2 caulier.gilles 2009-04-25 08:57:37 UTC
The crash appear in new c++ operator to allocate memory when image is loaded...

There is no reason for that. Sound like something is broken in your system...

Andy, Marcel, do you see another stuff ?

Gilles
Comment 3 Andi Clemens 2009-04-25 09:53:47 UTC
Something is happening in qimgloader.cpp:99.
We had a similar problem before, at the same line, I think it was while loading a TIF file. This is a simple uchar mem alloc, so I really don't know what could be wrong here. I've never seen new() just crash, this can only happen when no memory is available at all, right?
So this would mean the users memory was completely filled AND the swap is also completely used. And even then new() would work I guess, I wrote some app at university to crash a computer in seconds. It allocated 1GB of RAM per second (also with new()), but it never crashed. The only thing you had to do was plug off the power cable because even keystrokes where not handled anymore :-)

If memory outrun is not the problem, what else can crash new()?

Andi
Comment 4 Andi Clemens 2009-04-25 10:05:38 UTC
Here is some "interesting" link (yeah I now, MS sucks ;-)):
http://msdn.microsoft.com/en-us/magazine/cc164087.aspx

This would mean we need to check the return of new every time? But to me it looks like new crashes before it even returns something (note it is happening in line 99, so crash is when actually allocating the mem, not using it somewhere else).
Comment 5 caulier.gilles 2009-04-25 10:10:50 UTC
Andi,

Yes. To be sure new must return a valid pointer if allocation is fine. Else, new return 0. So this code can be used :

uchar* myData = new uchar[mySize];
if (!myData) return false;

// myData can be used here.

return true;

But yes, as trace said, crash appear in new operator...
Comment 6 Andi Clemens 2009-04-25 10:29:59 UTC
Sure, but I guess we could not just check for the return because it crashes before (like you just said).
Hmm how to debug something like that?
Comment 7 David Hill 2009-04-25 14:04:41 UTC
System does seem buggy like it is out of memory while splash screen is visible. slow to respond to mouse movements and clicks. click and application and it take several seconds to respond or doesn't respond until splash screen is gone.
Comment 8 Marcel Wiesweg 2009-04-25 15:08:18 UTC
See

http://www.parashift.com/c++-faq-lite/freestore-mgmt.html#faq-16.6

for what the standard says (and what MS is doing...)
Comment 9 Marcel Wiesweg 2009-04-25 15:09:55 UTC
David, please enable debug code 50003 with the kdebugdialog tool. I hope that you then get debug messages on the console. I would like to identify the picture that causes this, and it will be the last one printed on the console.
Comment 10 David Hill 2009-04-25 19:32:33 UTC
Last line printed:

digikam(8647)/digikam (core) Digikam::DImg::load: "/home/david/Pictures/Microsoft Clip Organizer/6A38B379.bmp"  : QIMAGE file identified

Deleted this image file and digikam starts. Quick check, connect to camera and down load images: ok, can see all images: ok, able to edit image: ok. Seems to be working.

FYI Image is a 440 Mib scan of an old photograph. Thanks for the help!!!

(This is my first bug report, should I mark as resolved or does someone else do that?)
Comment 11 Marcel Wiesweg 2009-04-26 14:24:11 UTC
This requires a fix, although it now works for you - we do not need to load the full image at startup. It seems that loading this huge image really is too much for your memory, so it's ok that operator new fails here (We load it as QImage, with the data in the QImage once, then copy it to an internal buffer, so it's at least twice the memory. And raw memory will be more than file size)
Comment 12 caulier.gilles 2009-05-19 15:54:33 UTC
Marcel, 

Following your comment #11, do you plan a fix for this entry ?

Gilles Caulier
Comment 13 Marcel Wiesweg 2009-05-19 19:04:42 UTC
Yes. Probably, catch the bad_alloc exception in some well selected locations like this one here.
Comment 14 John Schmitt 2009-08-12 19:25:31 UTC
Application: digiKam (digikam), signal SIGSEGV
0x0000003bd10a3fa1 in nanosleep () from /lib64/libc.so.6
[Current thread is 1 (Thread 0x7fcd9e5c2820 (LWP 21304))]

Thread 5 (Thread 0x7fcd94a63910 (LWP 21305)):
#0  0x0000003bd1c0b2f9 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x0000003bdd05ad7b in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib64/libQtCore.so.4
#2  0x000000000063bb9b in ?? ()
#3  0x0000003bdd059cd5 in ?? () from /usr/lib64/libQtCore.so.4
#4  0x0000003bd1c0686a in start_thread () from /lib64/libpthread.so.0
#5  0x0000003bd10de39d in clone () from /lib64/libc.so.6
#6  0x0000000000000000 in ?? ()

Thread 4 (Thread 0x7fcd8fa47910 (LWP 21306)):
#0  0x0000003bd1c0b2f9 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x0000003bdd05ad7b in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib64/libQtCore.so.4
#2  0x0000003be9f2c372 in Digikam::LoadSaveThread::run() () from /usr/lib64/libdigikamcore.so.1
#3  0x0000003bdd059cd5 in ?? () from /usr/lib64/libQtCore.so.4
#4  0x0000003bd1c0686a in start_thread () from /lib64/libpthread.so.0
#5  0x0000003bd10de39d in clone () from /lib64/libc.so.6
#6  0x0000000000000000 in ?? ()

Thread 3 (Thread 0x7fcd8f046910 (LWP 21307)):
#0  0x0000003bd1c0b2f9 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x0000003bdd05ad7b in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib64/libQtCore.so.4
#2  0x0000003be9f2c372 in Digikam::LoadSaveThread::run() () from /usr/lib64/libdigikamcore.so.1
#3  0x0000003bdd059cd5 in ?? () from /usr/lib64/libQtCore.so.4
#4  0x0000003bd1c0686a in start_thread () from /lib64/libpthread.so.0
#5  0x0000003bd10de39d in clone () from /lib64/libc.so.6
#6  0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7fcd875a6910 (LWP 21308)):
#0  0x0000003bd1c0b57d in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007fcd8ca395c1 in ?? () from /usr/lib64/libxine.so.1
#2  0x0000003bd1c0686a in start_thread () from /lib64/libpthread.so.0
#3  0x0000003bd10de39d in clone () from /lib64/libc.so.6
#4  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7fcd9e5c2820 (LWP 21304)):
[KCrash Handler]
#5  0x00007fcd856d8373 in shmat () from /usr/lib64/xine/plugins/1.26/xineplug_vo_out_xcbshm.so
#6  0x00007fcd8ca41e22 in _x_load_video_output_plugin () from /usr/lib64/libxine.so.1
#7  0x00007fcd8ca41eb9 in xine_open_video_driver () from /usr/lib64/libxine.so.1
#8  0x00007fcd8ccca6b7 in ?? () from /usr/lib64/kde4/plugins/phonon_backend/phonon_xine.so
#9  0x00007fcd8cccacd4 in ?? () from /usr/lib64/kde4/plugins/phonon_backend/phonon_xine.so
#10 0x00007fcd8ccb2f5c in ?? () from /usr/lib64/kde4/plugins/phonon_backend/phonon_xine.so
#11 0x0000003be8e33e52 in ?? () from /usr/lib64/libphonon.so.4
#12 0x0000003be8e389d6 in ?? () from /usr/lib64/libphonon.so.4
#13 0x0000003be8e37ba4 in Phonon::VideoWidget::VideoWidget(QWidget*) () from /usr/lib64/libphonon.so.4
#14 0x0000003be8e3900e in ?? () from /usr/lib64/libphonon.so.4
#15 0x0000003be8e39270 in Phonon::VideoPlayer::VideoPlayer(Phonon::Category, QWidget*) () from /usr/lib64/libphonon.so.4
#16 0x000000000062f219 in ?? ()
#17 0x00000000005e2a74 in ?? ()
#18 0x000000000060b004 in ?? ()
#19 0x00000000005f1eb2 in ?? ()
#20 0x00000000005ffda7 in ?? ()
#21 0x00000000006600b2 in ?? ()
#22 0x0000003bd101ea2d in __libc_start_main () from /lib64/libc.so.6
#23 0x0000000000453439 in _start ()
Comment 15 caulier.gilles 2009-08-14 11:50:17 UTC
John,

Crash appear in xine phonon plugin. Check libxine package...

Gilles Caulier
Comment 16 Marcel Wiesweg 2009-10-29 17:39:18 UTC
std::bad_alloc fix is in place for a few months. Closing now.