Bug 468040 - Search for New Entries causes Error from Jasper 4.0.0
Summary: Search for New Entries causes Error from Jasper 4.0.0
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-DImg-JP2K (other bugs)
Version First Reported In: 8.0.0
Platform: Microsoft Windows Microsoft Windows
: NOR crash
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-01 16:39 UTC by schaeper.tim
Modified: 2023-11-22 09:26 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 8.1.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description schaeper.tim 2023-04-01 16:39:05 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Start Digikam
2. Wait for the Progress Bar "Looking for New Entries" to reach 30%
3. 

OBSERVED RESULT
Assertion Failed Error from Microsoft Visual C++ Runtime Library 
Jasper 4.0.0 jas_init.c line 505
Clicking Cancel, Retry or Ignore closes DigiKam

EXPECTED RESULT
Completing Search for new entries without error

SOFTWARE/OS VERSIONS

Edition	Windows 10 Home
Version	22H2
Installiert am	‎20.‎08.‎2020
Betriebssystembuild	19045.2728
Leistung	Windows Feature Experience Pack 120.2212.4190.0


ADDITIONAL INFORMATION

Removing the "DImg_JPEG2000_Plugin.dll" from \digiKam\plugins\digikam\dimg\ lets me advance search for new entries without error.
Comment 1 Maik Qualmann 2023-04-01 19:02:01 UTC
Git commit 8325d683129a52f416ec1ef4945da59beed9d42d by Maik Qualmann.
Committed on 01/04/2023 at 19:00.
Pushed by mqualmann into branch 'master'.

compile libjasper with multithreading support

M  +1    -0    project/bundles/3rdparty/ext_jasper/CMakeLists.txt

https://invent.kde.org/graphics/digikam/commit/8325d683129a52f416ec1ef4945da59beed9d42d
Comment 2 Maik Qualmann 2023-04-01 19:11:57 UTC
Git commit bcf1e86fe619e4089561612ed7a05d530d0afe5f by Maik Qualmann.
Committed on 01/04/2023 at 19:10.
Pushed by mqualmann into branch 'master'.

remove libjasper initial thread creation

M  +1    -5    core/dplugins/dimg/jpeg2000/dimgjpeg2000plugin.cpp

https://invent.kde.org/graphics/digikam/commit/bcf1e86fe619e4089561612ed7a05d530d0afe5f
Comment 3 caulier.gilles 2023-04-02 09:14:00 UTC
Hi Maik,

Jasper lib is compiled as MXE and Macports package. So your change in 3rd-party cmake build for the bundle will affect only the AppImage.

Gilles
Comment 4 Maik Qualmann 2023-04-02 09:17:39 UTC
Yes, I can undo the change, also because it is ON by default. I'm not quite sure yet if we need to secure libjasper against different threads.

Maik
Comment 5 caulier.gilles 2023-04-02 10:04:56 UTC
No need to revert even if option is turned on by default. It will be a good remember tip

Gilles
Comment 6 caulier.gilles 2023-04-02 10:06:42 UTC
Tim,

Windows 8.0.0 pre-release installer is re-build and published with last Maik changes. Please try again and give us a feedback

https://files.kde.org/digikam/

Gilles Caulier
Comment 7 Maik Qualmann 2023-04-02 14:12:39 UTC
Git commit 3c4dcc53d4495f7d036674aca4a8baa0c17ffb6a by Maik Qualmann.
Committed on 02/04/2023 at 14:11.
Pushed by mqualmann into branch 'master'.

call jas_cleanup_library() in the plugin deconstructor
The error message in Bug 468040 can only occur if jas_init_library()
is called a second time. This can only happen if the plugin
constructor is called a second time. Why this occurs on
Windows is still unknown to me.

M  +0    -4    core/dplugins/dimg/jpeg2000/dimgjpeg2000plugin.cpp
M  +0    -1    core/dplugins/dimg/jpeg2000/dimgjpeg2000plugin.h

https://invent.kde.org/graphics/digikam/commit/3c4dcc53d4495f7d036674aca4a8baa0c17ffb6a
Comment 8 schaeper.tim 2023-04-02 16:15:45 UTC
(In reply to caulier.gilles from comment #6)
> Tim,
> 
> Windows 8.0.0 pre-release installer is re-build and published with last Maik
> changes. Please try again and give us a feedback
> 
> https://files.kde.org/digikam/
> 
> Gilles Caulier

Updated to latest pre-release. The search for new items completed without errors and JPEG-2000 Loader Plugin active.
Comment 9 caulier.gilles 2023-11-22 07:22:40 UTC
Maik,

With VCPKG build for Windows, Jasper 4.0.0 is used. Starting digiKAm from a Windows terminal show this warning:

$ ./digikam
WARNING: JasPer memory limit set to EXCESSIVELY LARGE value (i.e., limit exceeds system memory size (1073741824 > 0)

Did we set a limit in JPEG2000 image loader code ?

Gilles
Comment 10 Maik Qualmann 2023-11-22 09:02:45 UTC
Hi Gilles,

yes, we have to set a limit, we can reduce it.

https://invent.kde.org/graphics/digikam/-/blob/master/core/dplugins/dimg/jpeg2000/dimgjpeg2000plugin.cpp?ref_type=heads#L66

Maik
Comment 11 caulier.gilles 2023-11-22 09:23:39 UTC
ok, the warning come from libjasper at this line :

https://github.com/jasper-software/jasper/blob/master/src/libjasper/base/jas_init.c#L527

Gilles
Comment 12 caulier.gilles 2023-11-22 09:26:37 UTC
Git commit 5042861ea9fa25ba1a964fc0d9d8841a6ec49fac by Gilles Caulier.
Committed on 22/11/2023 at 10:25.
Pushed by cgilles into branch 'master'.

Set max memory size to 75 % instead 90% for the JPEG2000 codec

M  +2    -2    core/dplugins/dimg/jpeg2000/dimgjpeg2000plugin.cpp

https://invent.kde.org/graphics/digikam/-/commit/5042861ea9fa25ba1a964fc0d9d8841a6ec49fac