Bug 451868 - Crash while creating quality
Summary: Crash while creating quality
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Maintenance-Quality (show other bugs)
Version: 7.6.0
Platform: Manjaro Linux
: NOR crash
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-24 21:08 UTC by Lars
Modified: 2022-04-10 19:21 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 7.7.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lars 2022-03-24 21:08:22 UTC
SUMMARY
digikam crashes after a few minutes when trying to create quality data. Using all cores to create the quality data will reliably crash digikam within a few seconds - everytime with the same error message:

```
terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.5.5) /build/opencv/src/opencv-4.5.5/modules/core/src/matrix.cpp:810: error: (-215:Assertion failed) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function 'Mat'

zsh: IOT instruction (core dumped)  digikam
```

I do not know which image produces the crash. Any help to find out, which image it is, appreciated.


SOFTWARE/OS VERSIONS

KDE Frameworks Version: 5.91.0
Qt Version: 5.15.3 (built against 5.15.2)
Comment 1 Maik Qualmann 2022-03-24 21:19:46 UTC
Start digiKam in the terminal with enabled debug output and post the messages.

export QT_LOGGING_RULES="digikam*=true"

Maik
Comment 2 caulier.gilles 2022-03-25 02:34:40 UTC
Maik, I'm not sure but it sound like OpenCV exception are not catch by digiKam in new quality code written by the student last summer.
This will prevent the crash.
Gilles
Comment 3 Lars 2022-03-25 06:48:15 UTC
I've added the export variable, but it did not produce more insight than before:
```
digikam.dimg: Detect if each part is motion blur
digikam.dimg: Detect if each part is motion blur
digikam.dimg: Detect if each part is motion blur
digikam.dimg: Standard Deviation for group of lines  0.452814
digikam.dimg: Detect if each part is motion blur
digikam.dimg: Standard Deviation for group of lines  0.838613
digikam.dimg: Detect if each part is motion blur
digikam.dimg: Standard Deviation for group of lines  0.473135
digikam.dimg: Detect if each part is motion blur
digikam.dimg: Standard Deviation for group of lines  0.878844
terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.5.5) /build/opencv/src/opencv-4.5.5/modules/core/src/matrix.cpp:810: error: (-215:Assertion failed) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function 'Mat'
```

What it *seems* like is that the crash is not reliable, because I had to wait for hours this time, before it crashed. Might be a race condition.
Comment 4 Lars 2022-03-25 07:09:46 UTC
There actually seem to be multiple issues... Running it on all cores produces different errors:
- `double free or corruption (fasttop)`
- `malloc_consolidate(): invalid chunk size`

I've uploaded all logs here: https://box.kumbier.it/f/8afce38f60ce4cd3a3fb/?dl=1
Comment 5 Maik Qualmann 2022-03-25 08:00:57 UTC
Git commit 1c81e58af66defd71c0e64246afdd360feb19f9d by Maik Qualmann.
Committed on 25/03/2022 at 08:00.
Pushed by mqualmann into branch 'qt5-maintenance'.

catch opencv exceptions in image quality code

M  +184  -109  core/libs/dimg/filters/imgqsort/detector/blur_detector.cpp
M  +69   -28   core/libs/dimg/filters/imgqsort/detector/compression_detector.cpp
M  +20   -7    core/libs/dimg/filters/imgqsort/detector/detector.cpp
M  +15   -2    core/libs/dimg/filters/imgqsort/detector/exposure_detector.cpp
M  +137  -48   core/libs/dimg/filters/imgqsort/detector/noise_detector.cpp

https://invent.kde.org/graphics/digikam/commit/1c81e58af66defd71c0e64246afdd360feb19f9d
Comment 6 Maik Qualmann 2022-03-25 08:06:28 UTC
Make sure you have disabled hardware acceleration for OpenCV (OpenCL) in the digiKam settings under Miscellaneous-> System.

Maik
Comment 7 Lars 2022-03-25 08:33:53 UTC
(In reply to Maik Qualmann from comment #6)
> Make sure you have disabled hardware acceleration for OpenCV (OpenCL) in the
> digiKam settings under Miscellaneous-> System.
> 
> Maik

it's deactivated. I'm currently trying a run of the weekly build with all cores to see, if the bug is reproducible there.

Is there a pipeline or docker image that I could use to build an appimage of your qt5-maintenance branch?
Comment 8 Lars 2022-03-25 09:47:16 UTC
I can confirm the bug on 7.7.0-20220323T020040-x86-64
Comment 9 caulier.gilles 2022-03-25 12:12:11 UTC
No, there is no Docker to build AppImage. We use a real computer with Linux to compile and build the bundle.

Gilles Caulier
Comment 10 Lars 2022-03-26 10:19:42 UTC
(In reply to caulier.gilles from comment #9)
> No, there is no Docker to build AppImage. We use a real computer with Linux
> to compile and build the bundle.
> 
> Gilles Caulier

someone actually builds the weekly appimage by hand and uploads it? Without CI/CD?
Comment 11 caulier.gilles 2022-03-27 15:33:15 UTC
New pre-release AppImage is online now.

Gilles Caulier
Comment 12 Lars 2022-03-30 20:55:51 UTC
(In reply to caulier.gilles from comment #11)
> New pre-release AppImage is online now.
> 
> Gilles Caulier

Thank you - I tried it and it's still crashing:
> double free or corruption (fasttop)
> /tmp/.mount_digiKa7FO5hR/AppRun: Zeile 177: 42459 Abgebrochen             (Speicherabzug geschrieben) digikam $@

the second time I got a malloc error. I tried to pin it down to an image, but when I just run it against the last image (more specifically the album) that failed, it went through smoothly.
Comment 13 Maik Qualmann 2022-03-31 06:35:10 UTC
Can you please download the debug AppImage and start it with the "debug" option in the command line. It is then run in the internal GDB, start with "r" and after the crash type "bt" for the backtrace. Please post the backtrace.

Maik
Comment 14 Lars 2022-03-31 07:39:12 UTC
(In reply to Maik Qualmann from comment #13)

Of course - here it is:
---
Thread 96 "Thread (pooled)" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffea9ffb640 (LWP 68951)]
QList<Digikam::ImageQualityCalculator::ResultDetection>::node_copy (src=0x7ffe5ce39f80, to=0x7ffea4434f98, from=0x7ffe0922c3b0, this=0x7ffea44a3108) at ././/include/QtCore/qlist.h:492
492     ././/include/QtCore/qlist.h: Datei oder Verzeichnis nicht gefunden.
(gdb) bt
#0  QList<Digikam::ImageQualityCalculator::ResultDetection>::node_copy(QList<Digikam::ImageQualityCalculator::ResultDetection>::Node*, QList<Digikam::ImageQualityCalculator::ResultDetection>::Node*, QList<Digikam::ImageQualityCalculator::ResultDetection>::Node*) (src=0x7ffe5ce39f80, to=0x7ffea4434f98, from=0x7ffe0922c3b0, this=0x7ffea44a3108) at ././/include/QtCore/qlist.h:492
#1  QList<Digikam::ImageQualityCalculator::ResultDetection>::detach_helper(int) (this=0x7ffea44a3108, alloc=<optimized out>) at ././/include/QtCore/qlist.h:835
#2  0x00007ffff60dee0a in QList<Digikam::ImageQualityCalculator::ResultDetection>::detach_helper() (this=0x7ffea44a3108) at ././/include/QtCore/qlist.h:849
#3  QList<Digikam::ImageQualityCalculator::ResultDetection>::detach() (this=0x7ffea44a3108) at ././/include/QtCore/qlist.h:178
#4  QList<Digikam::ImageQualityCalculator::ResultDetection>::begin() (this=0x7ffea44a3108) at ././/include/QtCore/qlist.h:338
#5  Digikam::ImageQualityCalculator::adjustWeightByQualityLevel() const (this=this@entry=0x7ffea44a30e0) at /b/dktemp/digikam-qt5-maintenance/core/libs/dimg/filters/imgqsort/imagequalitycalculator.cpp:120
#6  0x00007ffff60df023 in Digikam::ImageQualityCalculator::calculateQuality() const (this=0x7ffea44a30e0) at /b/dktemp/digikam-qt5-maintenance/core/libs/dimg/filters/imgqsort/imagequalitycalculator.cpp:99
#7  0x00007ffff60de94c in Digikam::ImageQualityParser::startAnalyse() (this=this@entry=0x7ffea4390ea0) at /b/dktemp/digikam-qt5-maintenance/core/libs/dimg/filters/imgqsort/imagequalityparser.cpp:160
#8  0x00007ffff7638b6f in Digikam::ImageQualityTask::run() (this=0xaf8c200) at /b/dktemp/digikam-qt5-maintenance/core/utilities/maintenance/imagequalitytask.cpp:123
#9  0x00007ffff38de9e1 in  () at /tmp/.mount_digiKa1259c0/usr/lib/libQt5Core.so.5
#10 0x00007ffff38db8c9 in  () at /tmp/.mount_digiKa1259c0/usr/lib/libQt5Core.so.5
#11 0x00007ffff33345c2 in start_thread () at /usr/lib/libc.so.6
#12 0x00007ffff33b9584 in clone () at /usr/lib/libc.so.6
(gdb)

---
I ran it twice to ensure that both runs break in the same place (they did). Version I ran is digiKam-7.7.0-20220327T091422-x86-64-debug.appimage
Comment 15 caulier.gilles 2022-03-31 07:44:36 UTC
I think it miss a QList::isEmpty() call before to use the list...

Gilles Caulier
Comment 16 Maik Qualmann 2022-03-31 17:59:58 UTC
Git commit 134601315cec57501b049c3da08a5e22e7594219 by Maik Qualmann.
Committed on 31/03/2022 at 17:59.
Pushed by mqualmann into branch 'qt5-maintenance'.

use QMutexLocker to prevent access to QList from different threads

M  +9    -3    core/libs/dimg/filters/imgqsort/imagequalitycalculator.cpp

https://invent.kde.org/graphics/digikam/commit/134601315cec57501b049c3da08a5e22e7594219
Comment 17 Lars 2022-04-01 08:12:46 UTC
I've tried running the quality maintenance on just *one* core - the last check was with *all* cores. 

It also crashed on digiKam-7.7.0-20220327T091422-x86-64-debug.appimage with just one core, but in a different place. Should I open a new bug?

---
Digikam::BlurDetector::getWeightMap: cv::Exception: OpenCV(4.5.5) /b/ext_opencv/ext_opencv-prefix/src/ext_opencv/modules/core/src/matrix.cpp:811: error: (-215:Assertion failed) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function 'Mat'

terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.5.5) /b/ext_opencv/ext_opencv-prefix/src/ext_opencv/modules/core/src/arithm.cpp:650: error: (-209:Sizes of input arguments do not match) The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array' in function 'arithm_op'


Thread 44102 "Digikam::ImageQ" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fff35d2c640 (LWP 219382)]
0x00007ffff333634c in __pthread_kill_implementation () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff333634c in __pthread_kill_implementation () at /usr/lib/libc.so.6
#1  0x00007ffff32e94b8 in raise () at /usr/lib/libc.so.6
#2  0x00007ffff32d3534 in abort () at /usr/lib/libc.so.6
#3  0x00007ffff36837ee in __gnu_cxx::__verbose_terminate_handler() () at /usr/src/debug/gcc/libstdc++-v3/libsupc++/vterminate.cc:95
#4  0x00007ffff368fc4c in __cxxabiv1::__terminate(void (*)()) (handler=<optimized out>) at /usr/src/debug/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:48
#5  0x00007ffff368fcb9 in std::terminate() () at /usr/src/debug/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:58
#6  0x00007ffff38a1deb in qt_assert(char const*, char const*, int) () at /tmp/.mount_digiKa4DFGIc/usr/lib/libQt5Core.so.5
#7  0x00007ffff38a3630 in  () at /tmp/.mount_digiKa4DFGIc/usr/lib/libQt5Core.so.5
#8  0x00007ffff33345c2 in start_thread () at /usr/lib/libc.so.6
#9  0x00007ffff33b9584 in clone () at /usr/lib/libc.so.6
(gdb)
Comment 18 caulier.gilles 2022-04-01 09:21:39 UTC
Hi,

A new version of digiKam 7.7.0 pre-release AppImage will be online in one hour. Please test with this bundle which will include last fix in code.

Best

Gilles Caulier
Comment 19 Lars 2022-04-01 11:23:43 UTC
There seems to be a different problem - same as I've mentioned in my last comment. This time, the problem occured when I used *all* cores.

---

Digikam::ExifToolParser::slotMetaEngineSettingsChanged: ExifTool path: "exiftool"
Digikam::ExifToolProcess::checkExifToolProgram: Path to ExifTool: "exiftool"
Digikam::ExifToolProcess::start: ExifToolProcess::start(): create new ExifTool instance: "exiftool" ("-stay_open", "true", "-@", "-", "-common_args", "-charset", "filename=UTF8", "-charset", "iptc=UTF8")
[New Thread 0x7ffeccdfa640 (LWP 307778)]
[Thread 0x7ffece7fc640 (LWP 307721) exited]
Digikam::ImageQualityParser::startAnalyse: Final Quality estimated:  57.5384
Digikam::BlurDetector::isMotionBlur: Standard Deviation for group of lines  0.0969293
Digikam::BlurDetector::detectMotionBlurMap: Motion blurred part detected
Digikam::BlurDetector::isMotionBlur: Standard Deviation for group of lines  0.524234
Digikam::BlurDetector::detectMotionBlurMap: Motion blurred part detected
Digikam::BlurDetector::isMotionBlur: Standard Deviation for group of lines  0.509541
Digikam::BlurDetector::detectMotionBlurMap: Motion blurred part detected
[Thread 0x7ffeccdfa640 (LWP 307778) exited]
terminate called after throwing an instance of 'cv::Exception'
Digikam::BlurDetector::isMotionBlur: Standard Deviation for group of lines  0.964288
terminate called recursively
Digikam::BlurDetector::isMotionBlur: Standard Deviation for group of lines  0.0224309
Digikam::BlurDetector::detectMotionBlurMap: Motion blurred part detected
Digikam::BlurDetector::isMotionBlur: Standard Deviation for group of lines  0
Digikam::BlurDetector::isMotionBlur: Standard Deviation for group of lines  0.868536
Digikam::BlurDetector::detectMotionBlurMap: Motion blurred part detected
Digikam::BlurDetector::isMotionBlur: Standard Deviation for group of lines  0.793383
Digikam::BlurDetector::isMotionBlur: Standard Deviation for group of lines  0.896827
Digikam::BlurDetector::isMotionBlur: Standard Deviation for group of lines  0.78846
Digikam::BlurDetector::isMotionBlur: Standard Deviation for group of lines  0
Digikam::BlurDetector::detectMotionBlurMap: Motion blurred part detected
Digikam::BlurDetector::isMotionBlur: Standard Deviation for group of lines  1.05185
Digikam::BlurDetector::isMotionBlur: Standard Deviation for group of lines  0.792521
Digikam::BlurDetector::isMotionBlur: Standard Deviation for group of lines  0.0884398
Digikam::BlurDetector::detectMotionBlurMap: Motion blurred part detected
Digikam::BlurDetector::isMotionBlur: Standard Deviation for group of lines  0.882502
Digikam::BlurDetector::isMotionBlur: Standard Deviation for group of lines  0.857979
Digikam::BlurDetector::isMotionBlur: Standard Deviation for group of lines  0.84723
Digikam::BlurDetector::isMotionBlur: Standard Deviation for group of lines  0.848067

Thread 40426 "Digikam::ImageQ" received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffe8e7f4640 (LWP 307750)]
0x00007ffff333534c in __pthread_kill_implementation () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff333534c in __pthread_kill_implementation () at /usr/lib/libc.so.6
#1  0x00007ffff32e84b8 in raise () at /usr/lib/libc.so.6
#2  0x00007ffff32d2534 in abort () at /usr/lib/libc.so.6
#3  0x00007ffff3690ddd in __gnu_cxx::__verbose_terminate_handler() () at /usr/src/debug/gcc/libstdc++-v3/libsupc++/vterminate.cc:50
#4  0x00007ffff368ec4c in __cxxabiv1::__terminate(void (*)()) (handler=<optimized out>) at /usr/src/debug/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:48
#5  0x00007ffff368ecb9 in std::terminate() () at /usr/src/debug/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:58
#6  0x00007ffff38a0deb in qt_assert(char const*, char const*, int) () at /tmp/.mount_digiKa7qserd/usr/lib/libQt5Core.so.5
#7  0x00007ffff38a2630 in  () at /tmp/.mount_digiKa7qserd/usr/lib/libQt5Core.so.5
#8  0x00007ffff33335c2 in start_thread () at /usr/lib/libc.so.6
#9  0x00007ffff33b8584 in clone () at /usr/lib/libc.so.6
(gdb)
Comment 20 caulier.gilles 2022-04-01 11:32:53 UTC
yes, but did you try the new AppImage bundle pre-release, because the last commit from Maik is done especially to fix non-reentrancy...

Gilles Caulier
Comment 21 Lars 2022-04-01 11:43:16 UTC
yes, I used version digiKam-7.7.0-20220401T090402-x86-64-debug.appimage
Comment 22 Lars 2022-04-01 13:52:26 UTC
I can confirm the problem still existing even with *single* core operation in digiKam-7.7.0-20220401T090402-x86-64-debug.appimage

---

Digikam::BlurDetector::getWeightMap: cv::Exception: OpenCV(4.5.5) /b/ext_opencv/ext_opencv-prefix/src/ext_opencv/modules/core/src/matrix.cpp:811: error: (-215:Assertion failed) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function 'Mat'

terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.5.5) /b/ext_opencv/ext_opencv-prefix/src/ext_opencv/modules/core/src/arithm.cpp:650: error: (-209:Sizes of input arguments do not match) The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array' in function 'arithm_op'


Thread 44012 "Digikam::ImageQ" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fff34d2a640 (LWP 386197)]
0x00007ffff333534c in __pthread_kill_implementation () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff333534c in __pthread_kill_implementation () at /usr/lib/libc.so.6
#1  0x00007ffff32e84b8 in raise () at /usr/lib/libc.so.6
#2  0x00007ffff32d2534 in abort () at /usr/lib/libc.so.6
#3  0x00007ffff36827ee in __gnu_cxx::__verbose_terminate_handler() () at /usr/src/debug/gcc/libstdc++-v3/libsupc++/vterminate.cc:95
#4  0x00007ffff368ec4c in __cxxabiv1::__terminate(void (*)()) (handler=<optimized out>) at /usr/src/debug/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:48
#5  0x00007ffff368ecb9 in std::terminate() () at /usr/src/debug/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:58
#6  0x00007ffff38a0deb in qt_assert(char const*, char const*, int) () at /tmp/.mount_digiKawlrStK/usr/lib/libQt5Core.so.5
#7  0x00007ffff38a2630 in  () at /tmp/.mount_digiKawlrStK/usr/lib/libQt5Core.so.5
#8  0x00007ffff33335c2 in start_thread () at /usr/lib/libc.so.6
#9  0x00007ffff33b8584 in clone () at /usr/lib/libc.so.6
(gdb)
Comment 23 Maik Qualmann 2022-04-02 06:20:15 UTC
I think I found the cause. When I create an auto focus point that has negative position or size, the crash is triggered. So we have to check in the Auto Focus Extractor if the values are valid.

Maik
Comment 24 Maik Qualmann 2022-04-02 10:53:37 UTC
Git commit 86c88f72fe73d569c977960038685b01d60effa6 by Maik Qualmann.
Committed on 02/04/2022 at 10:52.
Pushed by mqualmann into branch 'qt5-maintenance'.

check if the auto focus point size is valid

M  +6    -0    core/libs/metadataengine/focuspoint/focuspoints_extractor_canon.cpp
M  +17   -15   core/libs/metadataengine/focuspoint/focuspoints_extractor_exif.cpp
M  +16   -14   core/libs/metadataengine/focuspoint/focuspoints_extractor_nikon.cpp
M  +14   -12   core/libs/metadataengine/focuspoint/focuspoints_extractor_panasonic.cpp
M  +16   -14   core/libs/metadataengine/focuspoint/focuspoints_extractor_sony.cpp
M  +14   -12   core/libs/metadataengine/focuspoint/focuspoints_extractor_xmp.cpp

https://invent.kde.org/graphics/digikam/commit/86c88f72fe73d569c977960038685b01d60effa6
Comment 25 Lars 2022-04-02 12:57:24 UTC
(In reply to Maik Qualmann from comment #24)

Thank you - I'll try it tomorrow, when the new weekly appimage is out.
Comment 26 caulier.gilles 2022-04-02 13:17:29 UTC
New AppImge is under process and it will be online in one hour..

Best Week end

Gilles Caulier
Comment 27 Lars 2022-04-03 14:11:39 UTC
unfortunately it's still not fixed. :(

I've tested against digiKam-7.7.0-20220402T111749-x86-64-debug.appimage  with *all* cores.

---
Digikam::BlurDetector::detectMotionBlurMap: Motion blurred part detected
Digikam::BlurDetector::isMotionBlur: Standard Deviation for group of lines  1.02026
Digikam::BlurDetector::isMotionBlur: Standard Deviation for group of lines  1.03988

Thread 40607 "Digikam::ImageQ" received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffe967fc640 (LWP 493776)]
0x00007ffff333534c in __pthread_kill_implementation () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff333534c in __pthread_kill_implementation () at /usr/lib/libc.so.6
#1  0x00007ffff32e84b8 in raise () at /usr/lib/libc.so.6
#2  0x00007ffff32d2534 in abort () at /usr/lib/libc.so.6
#3  0x00007ffff36827ee in __gnu_cxx::__verbose_terminate_handler() () at /usr/src/debug/gcc/libstdc++-v3/libsupc++/vterminate.cc:95
#4  0x00007ffff368ec4c in __cxxabiv1::__terminate(void (*)()) (handler=<optimized out>) at /usr/src/debug/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:48
#5  0x00007ffff368ecb9 in std::terminate() () at /usr/src/debug/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:58
#6  0x00007ffff38a0deb in qt_assert(char const*, char const*, int) () at /tmp/.mount_digiKakEAKQ5/usr/lib/libQt5Core.so.5
#7  0x00007ffff38a2630 in  () at /tmp/.mount_digiKakEAKQ5/usr/lib/libQt5Core.so.5
#8  0x00007ffff33335c2 in start_thread () at /usr/lib/libc.so.6
#9  0x00007ffff33b8584 in clone () at /usr/lib/libc.so.6
(gdb)
Comment 28 Maik Qualmann 2022-04-03 15:14:34 UTC
Git commit e242e198419e8eb442518d366ff62d50201384cf by Maik Qualmann.
Committed on 03/04/2022 at 15:13.
Pushed by mqualmann into branch 'qt5-maintenance'.

try with a recursive mutex

M  +2    -1    core/libs/dimg/filters/imgqsort/imagequalitycalculator.cpp

https://invent.kde.org/graphics/digikam/commit/e242e198419e8eb442518d366ff62d50201384cf
Comment 29 Lars 2022-04-09 20:50:48 UTC
(In reply to Maik Qualmann from comment #28)

Are your changes in version digiKam-7.7.0-20220407T100631-x86-64-debug.appimage ?
Tried it with all cpu cores, crashed again.

---
[Thread 0x7ffea97fa640 (LWP 967745) exited]
Digikam::BlurDetector::getWeightMap: cv::Exception: OpenCV(4.5.5) /b/ext_opencv/ext_opencv-prefix/src/ext_opencv/modules/core/src/matrix.cpp:811: error: (-215:Assertion failed) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function 'Mat'

Digikam::BlurDetector::getWeightMap: cv::Exception: OpenCV(4.5.5) /b/ext_opencv/ext_opencv-prefix/src/ext_opencv/modules/core/src/matrix.cpp:811: error: (-215:Assertion failed) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function 'Mat'

terminate called after throwing an instance of 'cv::Exception'
terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.5.5) /b/ext_opencv/ext_opencv-prefix/src/ext_opencv/modules/core/src/arithm.cpp:650: error: (-209:Sizes of input arguments do not match) The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array' in function 'arithm_op'

  what():  OpenCV(4.5.5) /b/ext_opencv/ext_opencv-prefix/src/ext_opencv/modules/core/src/arithm.cpp:650: error: (-209:Sizes of input arguments do not match) The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array' in function 'arithm_op'

[Thread 0x7ffec77fe640 (LWP 967738) exited]
[Thread 0x7ffeabfff640 (LWP 967737) exited]

Thread 44047 "Digikam::ImageQ" received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffee0dea640 (LWP 967718)]
0x00007ffff333534c in __pthread_kill_implementation () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff333534c in __pthread_kill_implementation () at /usr/lib/libc.so.6
#1  0x00007ffff32e84b8 in raise () at /usr/lib/libc.so.6
#2  0x00007ffff32d2534 in abort () at /usr/lib/libc.so.6
#3  0x00007ffff36827ee in __gnu_cxx::__verbose_terminate_handler() () at /usr/src/debug/gcc/libstdc++-v3/libsupc++/vterminate.cc:95
#4  0x00007ffff368ec4c in __cxxabiv1::__terminate(void (*)()) (handler=<optimized out>) at /usr/src/debug/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:48
#5  0x00007ffff368ecb9 in std::terminate() () at /usr/src/debug/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:58
#6  0x00007ffff38a0deb in qt_assert(char const*, char const*, int) () at /tmp/.mount_digiKaHhiDeV/usr/lib/libQt5Core.so.5
#7  0x00007ffff38a2630 in  () at /tmp/.mount_digiKaHhiDeV/usr/lib/libQt5Core.so.5
#8  0x00007ffff33335c2 in start_thread () at /usr/lib/libc.so.6
#9  0x00007ffff33b8584 in clone () at /usr/lib/libc.so.6
(gdb)
Comment 30 Maik Qualmann 2022-04-10 10:24:00 UTC
Git commit 1589a8ce8d5862f4f48406a66af59b180cd02f87 by Maik Qualmann.
Committed on 10/04/2022 at 10:23.
Pushed by mqualmann into branch 'qt5-maintenance'.

fix crash in openCV BlurDetector

M  +18   -7    core/libs/dimg/filters/imgqsort/detector/blur_detector.cpp

https://invent.kde.org/graphics/digikam/commit/1589a8ce8d5862f4f48406a66af59b180cd02f87
Comment 31 Lars 2022-04-10 19:09:16 UTC
(In reply to Maik Qualmann from comment #30)
> Git commit 1589a8ce8d5862f4f48406a66af59b180cd02f87 by Maik Qualmann.
> Committed on 10/04/2022 at 10:23.
> Pushed by mqualmann into branch 'qt5-maintenance'.
> 
> fix crash in openCV BlurDetector
> 
> M  +18   -7    core/libs/dimg/filters/imgqsort/detector/blur_detector.cpp
> 
> https://invent.kde.org/graphics/digikam/commit/
> 1589a8ce8d5862f4f48406a66af59b180cd02f87

I can confirm, that you fixed the bug in digiKam-7.7.0-20220410T110708-x86-64-debug.appimage - I've scanned the rest of my library without a problem and did a rescan, which is now at 60% without a crash. Thanks a ton!
Comment 32 Maik Qualmann 2022-04-10 19:21:17 UTC
Thank you for your feedback and testing the patches.

Maik