Bug 341566

Summary: digiKam crashed after closing when BQM was used before
Product: [Applications] digikam Reporter: Jan Wolter <online>
Component: BatchQueueManager-WorkflowAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: caulier.gilles, online
Priority: NOR    
Version: 4.6.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 4.6.0
Sentry Crash Report:

Description Jan Wolter 2014-12-05 08:29:53 UTC
Application: digikam (4.6.0)
KDE Platform Version: 4.13.3 (Compiled from sources)
Qt Version: 4.8.6
Operating System: Linux 3.13.0-24-generic x86_64
Distribution: Linux Mint 17 Qiana

-- Information about the crash:
The following bug occures in digiKam 4.6.0 only (actual git version). In dk 4.5.0 the bug is not present.

- What I was doing when the application crashed:

1. Add a raw file (in my case a orf file from Olympus camera) to the batch queue manager.
2. Set the raw decoding settings and add the convert2Jpeg tool
3. Then run the BQ. The file is then processed absolutely correct.
4. The error occures when you close the hole digiKam application.

The bug does not occure, when you load a previously saved workflow in the BQM. Only, when you create a new BQ. Really strange behaviour and new in dk 4.6.0.

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".
[Current thread is 1 (Thread 0x7fbf80d2c840 (LWP 18150))]

Thread 10 (Thread 0x7fbf64e05700 (LWP 18152)):
#0  0x00007fbf798e9c6d in poll () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007fbf68843248 in ?? () from /lib/x86_64-linux-gnu/libusb-1.0.so.0
#2  0x00007fbf76572182 in start_thread (arg=0x7fbf64e05700) at pthread_create.c:312
#3  0x00007fbf798f6fbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 9 (Thread 0x7fbf571fe700 (LWP 18154)):
#0  0x00007fbf798e9c6d in poll () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007fbf7210cfe4 in g_main_context_poll (priority=2147483647, n_fds=1, fds=0x7fbf480032d0, timeout=-1, context=0x7fbf480009a0) at /build/buildd/glib2.0-2.40.2/./glib/gmain.c:4028
#2  g_main_context_iterate (context=context@entry=0x7fbf480009a0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at /build/buildd/glib2.0-2.40.2/./glib/gmain.c:3729
#3  0x00007fbf7210d0ec in g_main_context_iteration (context=0x7fbf480009a0, may_block=1) at /build/buildd/glib2.0-2.40.2/./glib/gmain.c:3795
#4  0x00007fbf7a5017be in QEventDispatcherGlib::processEvents (this=0x7fbf480008c0, flags=...) at kernel/qeventdispatcher_glib.cpp:436
#5  0x00007fbf7a4d30af in QEventLoop::processEvents (this=this@entry=0x7fbf571fdd60, flags=...) at kernel/qeventloop.cpp:149
#6  0x00007fbf7a4d33a5 in QEventLoop::exec (this=this@entry=0x7fbf571fdd60, flags=...) at kernel/qeventloop.cpp:204
#7  0x00007fbf7a3cfc5f in QThread::exec (this=this@entry=0x103f080) at thread/qthread.cpp:537
#8  0x00007fbf7a4b4823 in QInotifyFileSystemWatcherEngine::run (this=0x103f080) at io/qfilesystemwatcher_inotify.cpp:265
#9  0x00007fbf7a3d232f in QThreadPrivate::start (arg=0x103f080) at thread/qthread_unix.cpp:349
#10 0x00007fbf76572182 in start_thread (arg=0x7fbf571fe700) at pthread_create.c:312
#11 0x00007fbf798f6fbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 8 (Thread 0x7fbf569fd700 (LWP 18156)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007fbf7a3d2816 in wait (time=18446744073709551615, this=0x1259460) at thread/qwaitcondition_unix.cpp:86
#2  QWaitCondition::wait (this=<optimized out>, mutex=0x10c7d88, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:158
#3  0x00007fbf7ea016bb in Digikam::ParkingThread::run (this=0x10c7d70) at /home/jan/Downloads/digikamGIT/core/libs/threads/threadmanager.cpp:119
#4  0x00007fbf7a3d232f in QThreadPrivate::start (arg=0x10c7d70) at thread/qthread_unix.cpp:349
#5  0x00007fbf76572182 in start_thread (arg=0x7fbf569fd700) at pthread_create.c:312
#6  0x00007fbf798f6fbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 7 (Thread 0x7fbf3e05c700 (LWP 18166)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
#1  0x00007fbf7a3d27f4 in wait (time=30000, this=0x23db610) at thread/qwaitcondition_unix.cpp:84
#2  QWaitCondition::wait (this=this@entry=0x23db3c0, mutex=mutex@entry=0x126cd18, time=30000) at thread/qwaitcondition_unix.cpp:158
#3  0x00007fbf7a3c60fa in QThreadPoolThread::run (this=0x23db3b0) at concurrent/qthreadpool.cpp:142
#4  0x00007fbf7a3d232f in QThreadPrivate::start (arg=0x23db3b0) at thread/qthread_unix.cpp:349
#5  0x00007fbf76572182 in start_thread (arg=0x7fbf3e05c700) at pthread_create.c:312
#6  0x00007fbf798f6fbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 6 (Thread 0x7fbf3e85d700 (LWP 18228)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
#1  0x00007fbf7a3d27f4 in wait (time=30000, this=0x23da2b0) at thread/qwaitcondition_unix.cpp:84
#2  QWaitCondition::wait (this=this@entry=0x23d9b90, mutex=mutex@entry=0x126cd18, time=30000) at thread/qwaitcondition_unix.cpp:158
#3  0x00007fbf7a3c60fa in QThreadPoolThread::run (this=0x23d9b80) at concurrent/qthreadpool.cpp:142
#4  0x00007fbf7a3d232f in QThreadPrivate::start (arg=0x23d9b80) at thread/qthread_unix.cpp:349
#5  0x00007fbf76572182 in start_thread (arg=0x7fbf3e85d700) at pthread_create.c:312
#6  0x00007fbf798f6fbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 5 (Thread 0x7fbf413c5700 (LWP 18229)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
#1  0x00007fbf7a3d27f4 in wait (time=30000, this=0x23da780) at thread/qwaitcondition_unix.cpp:84
#2  QWaitCondition::wait (this=this@entry=0x23da530, mutex=mutex@entry=0x126cd18, time=30000) at thread/qwaitcondition_unix.cpp:158
#3  0x00007fbf7a3c60fa in QThreadPoolThread::run (this=0x23da520) at concurrent/qthreadpool.cpp:142
#4  0x00007fbf7a3d232f in QThreadPrivate::start (arg=0x23da520) at thread/qthread_unix.cpp:349
#5  0x00007fbf76572182 in start_thread (arg=0x7fbf413c5700) at pthread_create.c:312
#6  0x00007fbf798f6fbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 4 (Thread 0x7fbf36704700 (LWP 18230)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
#1  0x00007fbf7a3d27f4 in wait (time=30000, this=0x23de640) at thread/qwaitcondition_unix.cpp:84
#2  QWaitCondition::wait (this=this@entry=0x23de3f0, mutex=mutex@entry=0x126cd18, time=30000) at thread/qwaitcondition_unix.cpp:158
#3  0x00007fbf7a3c60fa in QThreadPoolThread::run (this=0x23de3e0) at concurrent/qthreadpool.cpp:142
#4  0x00007fbf7a3d232f in QThreadPrivate::start (arg=0x23de3e0) at thread/qthread_unix.cpp:349
#5  0x00007fbf76572182 in start_thread (arg=0x7fbf36704700) at pthread_create.c:312
#6  0x00007fbf798f6fbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 3 (Thread 0x7fbf37792700 (LWP 18231)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
#1  0x00007fbf7a3d27f4 in wait (time=30000, this=0x23deac0) at thread/qwaitcondition_unix.cpp:84
#2  QWaitCondition::wait (this=this@entry=0x23de870, mutex=mutex@entry=0x126cd18, time=30000) at thread/qwaitcondition_unix.cpp:158
#3  0x00007fbf7a3c60fa in QThreadPoolThread::run (this=0x23de860) at concurrent/qthreadpool.cpp:142
#4  0x00007fbf7a3d232f in QThreadPrivate::start (arg=0x23de860) at thread/qthread_unix.cpp:349
#5  0x00007fbf76572182 in start_thread (arg=0x7fbf37792700) at pthread_create.c:312
#6  0x00007fbf798f6fbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 2 (Thread 0x7fbf40060700 (LWP 18232)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
#1  0x00007fbf7a3d27f4 in wait (time=30000, this=0x23dd3b0) at thread/qwaitcondition_unix.cpp:84
#2  QWaitCondition::wait (this=this@entry=0x23dd160, mutex=mutex@entry=0x126cd18, time=30000) at thread/qwaitcondition_unix.cpp:158
#3  0x00007fbf7a3c60fa in QThreadPoolThread::run (this=0x23dd150) at concurrent/qthreadpool.cpp:142
#4  0x00007fbf7a3d232f in QThreadPrivate::start (arg=0x23dd150) at thread/qthread_unix.cpp:349
#5  0x00007fbf76572182 in start_thread (arg=0x7fbf40060700) at pthread_create.c:312
#6  0x00007fbf798f6fbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 1 (Thread 0x7fbf80d2c840 (LWP 18150)):
[KCrash Handler]
#6  0x0000000000000000 in ?? ()
#7  0x000000000076b77d in Digikam::BatchTool::~BatchTool (this=0x1c4d4e0, __in_chrg=<optimized out>) at /home/jan/Downloads/digikamGIT/core/utilities/queuemanager/manager/batchtool.cpp:141
#8  0x0000000000799195 in Digikam::Convert2JPEG::~Convert2JPEG (this=0x1c4d4e0, __in_chrg=<optimized out>) at /home/jan/Downloads/digikamGIT/core/utilities/queuemanager/basetools/convert/convert2jpeg.cpp:56
#9  0x00000000007991c4 in Digikam::Convert2JPEG::~Convert2JPEG (this=0x1c4d4e0, __in_chrg=<optimized out>) at /home/jan/Downloads/digikamGIT/core/utilities/queuemanager/basetools/convert/convert2jpeg.cpp:58
#10 0x000000000076f80c in Digikam::BatchToolsManager::~BatchToolsManager (this=0x1c4f0e0, __in_chrg=<optimized out>) at /home/jan/Downloads/digikamGIT/core/utilities/queuemanager/manager/batchtoolsmanager.cpp:169
#11 0x000000000076fb76 in Digikam::BatchToolsManagerCreator::~BatchToolsManagerCreator (this=0x1c4f0e0, __in_chrg=<optimized out>) at /home/jan/Downloads/digikamGIT/core/utilities/queuemanager/manager/batchtoolsmanager.cpp:91
#12 0x000000000076eee9 in destroy () at /home/jan/Downloads/digikamGIT/core/utilities/queuemanager/manager/batchtoolsmanager.cpp:98
#13 0x00000000005c3947 in KCleanUpGlobalStatic::~KCleanUpGlobalStatic (this=0xc61e80 <Digikam::._228::operator->()::cleanUpObject>, __in_chrg=<optimized out>) at /usr/include/kglobal.h:62
#14 0x00007fbf79838149 in __run_exit_handlers (status=0, listp=0x7fbf79bbb6c8 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true) at exit.c:82
#15 0x00007fbf79838195 in __GI_exit (status=<optimized out>) at exit.c:104
#16 0x00007fbf7981decc in __libc_start_main (main=0x6fb8dd <main(int, char**)>, argc=5, argv=0x7fff1523cf68, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fff1523cf58) at libc-start.c:321
#17 0x0000000000496d09 in _start ()
Comment 1 caulier.gilles 2014-12-05 09:01:00 UTC
What the list of tool assigned to the queue ?

What the settings to all tools ?

What the main settings applied to the queue ?

How many files must be processing by the queue ?

Gilles Caulier
Comment 2 Jan Wolter 2014-12-05 09:08:16 UTC
I assigned only one tool to the queue: Convert to Jpeg. The settings there were: jpeg quality: 100 and Chroma subsampling: None.

The Raw decoding settings were:
- enabled 16 bits color depth
- enabled Interpolate RGB as four colors
- Quality: AHD v2
- enabled false colors in highlights
- enabled auto brightness
All other settings were default.

I added only one .orf file to the BQM.

I hope this information is sufficient to reproduce the problem on your computer.
Comment 3 caulier.gilles 2014-12-05 09:09:37 UTC
Following your trace :

#7  0x000000000076b77d in Digikam::BatchTool::~BatchTool (this=0x1c4d4e0,
__in_chrg=<optimized out>) at
/home/jan/Downloads/digikamGIT/core/utilities/queuemanager/manager/batchtool.cpp:141
#8  0x0000000000799195 in Digikam::Convert2JPEG::~Convert2JPEG (this=0x1c4d4e0,
__in_chrg=<optimized out>) at
/home/jan/Downloads/digikamGIT/core/utilities/queuemanager/basetools/convert/convert2jpeg.cpp:56

You have a JPEG converter tool assigned in BQM. It crash here :

https://projects.kde.org/projects/extragear/graphics/digikam/repository/revisions/master/entry/utilities/queuemanager/basetools/convert/convert2jpeg.cpp#L56

This appear when parent tool class want to delete instance of settings widget relevant :

https://projects.kde.org/projects/extragear/graphics/digikam/repository/revisions/master/entry/utilities/queuemanager/manager/batchtool.cpp#L141

This is fully relevant of my commit here :

https://projects.kde.org/projects/extragear/graphics/digikam/repository/revisions/04f3b6d9efba2aaca8026c7e41d36bef594539b9

... dedicated to fix a memory leak reported by SCAN coverity static analyser.

What happen when you comment line 141 from BatchTool class ?

Gilles Caulier
Comment 4 caulier.gilles 2014-12-05 11:04:24 UTC
Git commit a7c291050cb24c6c47ba419dc4657e737a10092e by Gilles Caulier.
Committed on 05/12/2014 at 11:03.
Pushed by cgilles into branch 'master'.

delete later settings widget to prevent crash when BQM is closed.

M  +3    -1    utilities/queuemanager/manager/batchtool.cpp

http://commits.kde.org/digikam/a7c291050cb24c6c47ba419dc4657e737a10092e
Comment 5 caulier.gilles 2014-12-05 11:05:25 UTC
Jan,

Check if my previous commit fix the problem on your computer.

Note : there is no crash before and after this commit on my computer.

Gilles Caulier
Comment 6 caulier.gilles 2014-12-05 13:15:16 UTC
Git commit 008fd43a16b35077ea21257039b384278a8b6be5 by Gilles Caulier.
Committed on 05/12/2014 at 13:14.
Pushed by cgilles into branch 'master'.

no need to delete settings widget here.
Owner is passed to ToolSettingsView, which will delete instance,
even if Valgrind report a memory leak.
FIXED-IN: 4.6.0

M  +3    -2    utilities/queuemanager/manager/batchtool.cpp

http://commits.kde.org/digikam/008fd43a16b35077ea21257039b384278a8b6be5
Comment 7 Jan Wolter 2014-12-05 15:50:59 UTC
Hi Gilles, I tested on my computer and the problem does not occur anymore!
Comment 8 Maik Qualmann 2018-12-25 15:40:26 UTC
Git commit c6a32e47b0ee010fcae4203db41a74c2e8c916cc by Maik Qualmann.
Committed on 25/12/2018 at 15:38.
Pushed by mqualmann into branch 'master'.

fix memory leak in the BQM tool
All settings widgets of the BQM tools were created at program
start and not deleted. Digikam now consumes about 30MB less
memory after the program starts.

M  +7    -3    core/utilities/queuemanager/manager/batchtool.cpp
M  +5    -0    core/utilities/queuemanager/manager/batchtool.h
M  +1    -2    core/utilities/queuemanager/manager/batchtoolsfactory.cpp
M  +28   -10   core/utilities/queuemanager/views/assignedlist.cpp
M  +5    -0    core/utilities/queuemanager/views/toolsettingsview.cpp

https://commits.kde.org/digikam/c6a32e47b0ee010fcae4203db41a74c2e8c916cc
Comment 9 Maik Qualmann 2018-12-25 17:28:35 UTC
Git commit 6bb4617ff948851c0cbe4dead5772eecfdd7c634 by Maik Qualmann.
Committed on 25/12/2018 at 17:27.
Pushed by mqualmann into branch 'master'.

prevent QTimer error messages if delete settings widget

M  +4    -3    core/utilities/queuemanager/manager/batchtool.cpp
M  +2    -3    core/utilities/queuemanager/manager/batchtool.h
M  +2    -2    core/utilities/queuemanager/views/toolsettingsview.cpp

https://commits.kde.org/digikam/6bb4617ff948851c0cbe4dead5772eecfdd7c634