Bug 443685 - When converting canon CR3 files to dng files in parallel digikam crashes.
Summary: When converting canon CR3 files to dng files in parallel digikam crashes.
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-Bqm-DngConverter (show other bugs)
Version: 7.3.0
Platform: Other Linux
: NOR crash
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-14 03:14 UTC by John Beatty
Modified: 2021-10-15 21:34 UTC (History)
2 users (show)

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


Attachments
digikam.console (10.33 KB, text/plain)
2021-10-15 00:59 UTC, John Beatty
Details
digikam.segfault.console (445.02 KB, text/plain)
2021-10-15 00:59 UTC, John Beatty
Details

Note You need to log in before you can comment on or make changes to this bug.
Description John Beatty 2021-10-14 03:14:57 UTC
SUMMARY
I selected 634 CR3 files to convert and start the batch queue manager with use all cores enabled. The program produces about 0 to 9 dng files then crashes. On some test runs the program didn't complete any dng files but was working on temp files.

STEPS TO REPRODUCE
1. In the albums select an album with some CR3 files.
2. In the batch queue manager queue the "Convert RAW to DNG" tool
3. Push the run button

OBSERVED RESULT
Digikam abends and vanishes from the screen. An inspection of the directory shows sometimes some dng files present. There are also some 20-56 BatchTool temp files present. Some of the temp files have data and others do not. Between the tests I removed any existing dng and temp files to keep a consistent methodology.


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.68.0
Qt Version: 5.12.37-generic

ADDITIONAL INFORMATION
Comment 1 caulier.gilles 2021-10-14 03:44:03 UTC
I cannot reproduce the crash here with my CR3 test files.

Can you precise :

- which Canon camera you use.
- Which Exiv2 version you use (Look in Help/Components Info for details).
- capture a GDB backtrace of crash.
- capture console traces during dysfunction.

See instructions here: https://www.digikam.org/contribute/

Gilles Caulier
Comment 2 Maik Qualmann 2021-10-14 05:50:36 UTC
One more question, how many CPU cores and memory does your computer have?

Maik
Comment 3 John Beatty 2021-10-15 00:59:41 UTC
Created attachment 142450 [details]
digikam.console

Hi Gilles,

Thanks for looking into this. I'm trying to put together the requested 
information.

1 These were raws from the Canon R5.

2 Exiv 11.88

3 I'm not sure how to get a GDB backtrace of the crash

4) I've attached two consoles one where it was not running in parallel 
and worked. I stopped it after about 150 or so files converted. So it 
works in serial mode. I've also attached a console with it running under 
catchsegv in parallel and failing. It doesn't  appear to get to far. On 
this run it only completed 1 dng. The file with the failure has segfault 
in the name (digikam.segfault.console). Just for a bit more context I 
ran digikam in parallel without catchsegv and the messages from digikam 
appear to be virtually identical so I don't think the catchsegv alters 
the output other than to display the backtrace info at the end of the 
console.

Thanks again for being so prompt in looking into this problem,

John B.

On 10/13/21 11:44 PM, bugzilla_noreply@kde.org wrote:
> https://bugs.kde.org/show_bug.cgi?id=443685
>
> --- Comment #1 from caulier.gilles@gmail.com ---
> I cannot reproduce the crash here with my CR3 test files.
>
> Can you precise :
>
> - which Canon camera you use.
> - Which Exiv2 version you use (Look in Help/Components Info for details).
> - capture a GDB backtrace of crash.
> - capture console traces during dysfunction.
>
> See instructions here: https://www.digikam.org/contribute/
>
> Gilles Caulier
>
Comment 4 John Beatty 2021-10-15 00:59:41 UTC
Created attachment 142451 [details]
digikam.segfault.console
Comment 5 John Beatty 2021-10-15 01:01:05 UTC
Hi Maik,

Thanks for looking into this. I'm running a Ryzen 5950x with 16 cores 
and 32 threads.

John B.

On 10/14/21 1:50 AM, Maik Qualmann wrote:
> https://bugs.kde.org/show_bug.cgi?id=443685
>
> Maik Qualmann <metzpinguin@gmail.com> changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                   CC|                            |metzpinguin@gmail.com
>
> --- Comment #2 from Maik Qualmann <metzpinguin@gmail.com> ---
> One more question, how many CPU cores and memory does your computer have?
>
> Maik
>
Comment 6 Maik Qualmann 2021-10-15 06:06:31 UTC
With a camera with 45 MP images and 16 cores, the memory will definitely not be sufficient. Either we limit the use of cores in general or we have to dynamically adjust the running threads based on memory usage.

Maik
Comment 7 John Beatty 2021-10-15 14:38:01 UTC
Hi Maik,

Making sure the program doesn't use more memory than the system has is a 
good thing. I re-ran the test case while watching memory. The memory 
usage never topped 40% of 64GB or approximately 26GB used.

Thanks,

John B.

On 10/15/21 2:06 AM, Maik Qualmann wrote:
> https://bugs.kde.org/show_bug.cgi?id=443685
>
> --- Comment #6 from Maik Qualmann <metzpinguin@gmail.com> ---
> With a camera with 45 MP images and 16 cores, the memory will definitely not be
> sufficient. Either we limit the use of cores in general or we have to
> dynamically adjust the running threads based on memory usage.
>
> Maik
>
Comment 8 Maik Qualmann 2021-10-15 21:26:05 UTC
I can reproduce the problem, it crashes in the DNG-SDK.

Maik
Comment 9 Maik Qualmann 2021-10-15 21:34:46 UTC
Git commit 46abc6fc9b90cb08af0fa401e9d4bc2b7c60b229 by Maik Qualmann.
Committed on 15/10/2021 at 21:33.
Pushed by mqualmann into branch 'master'.

remove initialize und terminate call from DNG-XMP-SDK
FIXED-IN: 7.4.0

M  +1    -1    NEWS
M  +2    -2    core/libs/dngwriter/dngwriter.cpp

https://invent.kde.org/graphics/digikam/commit/46abc6fc9b90cb08af0fa401e9d4bc2b7c60b229