Bug 434112 - digikam-7.2* crashes at first start after install while starting main view
Summary: digikam-7.2* crashes at first start after install while starting main view
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Setup-FirstRun (show other bugs)
Version: 7.2.0
Platform: Microsoft Windows Microsoft Windows
: NOR crash
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-07 15:08 UTC by Jever
Modified: 2021-03-13 14:15 UTC (History)
2 users (show)

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


Attachments
Pictures of what to see when starts up first time after install (471.33 KB, image/png)
2021-03-07 15:08 UTC, Jever
Details
Log of starting up after fresh install of 7.2.0 over 7.1.0 deinstalled before (28.35 KB, text/plain)
2021-03-07 16:31 UTC, Jever
Details
Log after deleting the facesengine folder (90.25 KB, text/plain)
2021-03-07 17:25 UTC, Jever
Details
facesengine folder individual files sha256 checksums (845 bytes, text/plain)
2021-03-07 17:52 UTC, Jever
Details
New Log of first run after install of 7.2.0 (70.98 KB, text/plain)
2021-03-08 09:50 UTC, Jever
Details
New log of first run after install of 7.2.0 (66.11 KB, text/plain)
2021-03-10 06:11 UTC, Jever
Details
New log of first run after install of 7.2.0 (60.88 KB, text/plain)
2021-03-11 12:50 UTC, Jever
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jever 2021-03-07 15:08:39 UTC
Created attachment 136457 [details]
Pictures of what to see when starts up first time after install

SUMMARY
Installing any digikam 7.2* version crashes at first start after install in Win7 64bit while starting main view.
digikam 7.1 is working ok.
I tried it since weeks to get 7.2 runningand failed.

STEPS TO REPRODUCE
1. Install digiKam-7.2.0-20210306T200522-Win64-debug.exe
2. Start digikam
3. It crashes, see the picture in attachement

OBSERVED RESULT
It chrashes at startup

EXPECTED RESULT
It should start up fine

SOFTWARE/OS VERSIONS
Windows: 7 64 bit
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Maik Qualmann 2021-03-07 15:16:54 UTC
We need the DebugView log from the start, as described here:

https://www.digikam.org/contribute/

Don't forget to set the environment variable.

I test digiKam-7.2.0 weekly on a Windows7 machine with no problems. Any weird anti-virus software installed?

Maik
Comment 2 Jever 2021-03-07 16:31:23 UTC
Created attachment 136462 [details]
Log of starting up after fresh install of 7.2.0 over 7.1.0 deinstalled before
Comment 3 Maik Qualmann 2021-03-07 16:46:25 UTC
Delete the folder "C:/Users/jever.LOKAL/AppData/Roaming/digikam/facesengine". The files will be downloaded again automatically.

Maik
Comment 4 Jever 2021-03-07 17:25:51 UTC
Created attachment 136463 [details]
Log after deleting the facesengine folder
Comment 5 Jever 2021-03-07 17:27:13 UTC
Thx, after deleting the folder "C:/Users/jever.LOKAL/AppData/Roaming/digikam/facesengine" it downloaded the files while first start up.
Then I end digikam as it said and started it a short time later again.
It crashed again in the same manner as before.
Comment 6 Maik Qualmann 2021-03-07 17:38:00 UTC
Ok, when downloading the files, the digiKam GUI starts. So it is definitely related to the loading of the model data into OpenCV. Can you create and post the SHA256 checksums of the individual files in the "Roaming\digikam\facesengine" folder?

Maik
Comment 7 Jever 2021-03-07 17:52:53 UTC
Created attachment 136464 [details]
facesengine folder individual files sha256 checksums

The SHA256 checksums of the individual files in the
"Roaming\digikam\facesengine" folder.
Comment 8 Maik Qualmann 2021-03-07 18:19:34 UTC
The SHA256 checksums are correct. Compared to digiKam-7.1.0, basically only the storage location has changed. At the moment I am at a loss as the problem has been reported for the first time so far.

Maik
Comment 9 Jever 2021-03-07 18:27:13 UTC
(In reply to Maik Qualmann from comment #8)
> The SHA256 checksums are correct. Compared to digiKam-7.1.0, basically only
> the storage location has changed. At the moment I am at a loss as the
> problem has been reported for the first time so far.
> 
> Maik

Thx so far Maik for your help.
What about this lines in the log which are the last when ending digikam?

00000474	490.48913574	[6640] QWaitCondition: Destroyed while threads are still waiting	
00000475	492.12698364	[6640] QEventDispatcherWin32::wakeUp: Failed to post a message (Ungültiges Fensterhandle)
Comment 10 Maik Qualmann 2021-03-07 18:39:39 UTC
The lines at the end are caused by the crash.

@Gilles
If I change the model data here under Windows, digiKam simply crashes without a window. The window with the Visual C++ runtime makes me think. Are we linking against a Visual C++ runtime at all, I don't think so?

Maik
Comment 11 caulier.gilles 2021-03-07 18:49:39 UTC
Hi Maik,

No definitively, digiKAm is not linked with MSVC, as all is cross compiled. linking with MSVC runtime is only necessary if a GUI component is used with DrMingw, and it's not the case, as i disable this feature.

The DrMingw component dropped is the GUI to show the backtrace when crash appears. The trace is stored in a log file instead. It's indicated to the terminal at digiKam startup.

Gilles
Comment 12 caulier.gilles 2021-03-07 18:54:18 UTC
But after verification here :

https://invent.kde.org/graphics/digikam/-/blob/master/project/bundles/3rdparty/ext_drmingw/CMakeLists.txt#L48

I remember to have updated DrMingw as Krita project, which extract and copy these file from the binary tarball :

dbghelp.dll
symsrv.dll

Perhaps these files use MSVC runtime, i'm not sure...

Gilles
Comment 13 Maik Qualmann 2021-03-07 18:59:26 UTC
Git commit 925e8f523bce37203dd898e4a8889b97af6c13a8 by Maik Qualmann.
Committed on 07/03/2021 at 18:58.
Pushed by mqualmann into branch 'master'.

catch exceptions from openCV when loading model data

M  +17   -2    core/libs/facesengine/detection/opencv-dnn/dnnfacedetectorssd.cpp
M  +19   -4    core/libs/facesengine/detection/opencv-dnn/dnnfacedetectoryolo.cpp
M  +18   -3    core/libs/facesengine/recognition/opencv-dnn/dnnfaceextractor.cpp

https://invent.kde.org/graphics/digikam/commit/925e8f523bce37203dd898e4a8889b97af6c13a8
Comment 14 Maik Qualmann 2021-03-07 19:00:28 UTC
The DebugView log shows that Windows 7 was correctly recognized and that DrMinGW was not installed.

Maik
Comment 15 Maik Qualmann 2021-03-07 19:02:48 UTC
Ok, the OpenCV exceptions are now caught here under Linux and there is no longer a crash. With the next version of Windows, we might see what the problem is.

Maik
Comment 16 Maik Qualmann 2021-03-08 07:42:56 UTC
A new digiKam-7.2.0 Windows version with the latest changes is available. Please test it and post the DebugView log from the start. There is no need to download the "-debug" version.

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

Maik
Comment 17 Jever 2021-03-08 09:36:58 UTC
(In reply to Maik Qualmann from comment #16)
> A new digiKam-7.2.0 Windows version with the latest changes is available.
> Please test it and post the DebugView log from the start. There is no need
> to download the "-debug" version.
> 
> https://files.kde.org/digikam/
> 
> Maik

Moin Maik,

I used digiKam-7.2.0-20210307T200519-Win64.exe for testing.
It installs ok.
while first start there is no download of facesengine and so no creating of the folder "C:/Users/jever.LOKAL/AppData/Roaming/digikam/facesengine".
It starts up and runs well as far as I can see.

Jever
Comment 18 Maik Qualmann 2021-03-08 09:41:52 UTC
The download must take place in any case if the files are not yet available. Please post the log to see if everything is really ok.

Maik
Comment 19 Jever 2021-03-08 09:50:46 UTC
Created attachment 136482 [details]
New Log of first run after install of 7.2.0

digiKam-7.2.0-20210307T200519-Win64.exe
Comment 20 Jever 2021-03-08 09:56:39 UTC
(In reply to Maik Qualmann from comment #18)
> The download must take place in any case if the files are not yet available.
> Please post the log to see if everything is really ok.
> 
> Maik

... I searched for the folder and recogniced that is already there.

I looked at the wrong folder (Local user / domain user)!
Sorry for the noise.

Jever
Comment 21 Maik Qualmann 2021-03-08 09:58:20 UTC
The face recognition will not work, however, an exception occurs in OpenCV. It just doesn't crash anymore.

--------------------------------------------------------------------------
[7152] digikam.facedb: "C:/Users/jever.LOKAL/AppData/Roaming/digikam/facesengine/openface_nn4.small2.v1.t7"	
[7152] digikam.facedb: cv::Exception: OpenCV(4.5.1) /mnt/data/7.x/project/bundles/mxe/temp.build/ext_opencv/ext_opencv-prefix/src/ext_opencv/modules/dnn/src/torch/THDiskFile.cpp:496: error: (-2:Unspecified error) cannot open <C:/Users/jever.LOKAL/AppData/Roaming/digikam/facesengine/openface_nn4.small2.v1.t7> in mode r  in function 'THDiskFile_new'	
--------------------------------------------------------------------------

This is not a file not found error, it cannot be opened. I suspect an anti-virus program is preventing access to the file.

Maik
Comment 22 Maik Qualmann 2021-03-08 18:46:33 UTC
Git commit e38bf9ba775a01a29cd499c5baeab4eb85c80972 by Maik Qualmann.
Committed on 08/03/2021 at 18:45.
Pushed by mqualmann into branch 'master'.

try with native separators

M  +6    -2    core/libs/facesengine/detection/opencv-dnn/dnnfacedetectorssd.cpp
M  +6    -2    core/libs/facesengine/detection/opencv-dnn/dnnfacedetectoryolo.cpp
M  +2    -2    core/libs/facesengine/preprocessing/recognition/openfacepreprocessor.cpp
M  +6    -3    core/libs/facesengine/recognition/opencv-dnn/dnnfaceextractor.cpp

https://invent.kde.org/graphics/digikam/commit/e38bf9ba775a01a29cd499c5baeab4eb85c80972
Comment 23 Jever 2021-03-08 19:13:44 UTC
(In reply to Maik Qualmann from comment #21)
> The face recognition will not work, however, an exception occurs in OpenCV.
> It just doesn't crash anymore.
> 
> --------------------------------------------------------------------------
> [7152] digikam.facedb:
> "C:/Users/jever.LOKAL/AppData/Roaming/digikam/facesengine/openface_nn4.
> small2.v1.t7"	
> [7152] digikam.facedb: cv::Exception: OpenCV(4.5.1)
> /mnt/data/7.x/project/bundles/mxe/temp.build/ext_opencv/ext_opencv-prefix/
> src/ext_opencv/modules/dnn/src/torch/THDiskFile.cpp:496: error:
> (-2:Unspecified error) cannot open
> <C:/Users/jever.LOKAL/AppData/Roaming/digikam/facesengine/openface_nn4.
> small2.v1.t7> in mode r  in function 'THDiskFile_new'	
> --------------------------------------------------------------------------
> 
> This is not a file not found error, it cannot be opened. I suspect an
> anti-virus program is preventing access to the file.
> 
> Maik

Hi Maik,

the only installed anti virus program on this machine is windows defender and that was deaktivated and not running.

Jever
Comment 24 Maik Qualmann 2021-03-08 19:22:19 UTC
A new Windows version with the changes may be available tomorrow. It would be nice if you would test it and post a log. The problem with this OpenCV model loading function can often be found on the web, but unfortunately no real solution.

Maik
Comment 25 Jever 2021-03-10 06:11:55 UTC
Created attachment 136549 [details]
New log of first run after install of 7.2.0

digiKam-7.2.0-20210309T200522-Win64.exe
Comment 26 Maik Qualmann 2021-03-10 07:09:21 UTC
Git commit 7214820504850f60679a813605cccde03449e7a9 by Maik Qualmann.
Committed on 10/03/2021 at 07:08.
Pushed by mqualmann into branch 'master'.

try with local 8 bit char* as path

M  +1    -1    core/libs/facesengine/recognition/opencv-dnn/dnnfaceextractor.cpp

https://invent.kde.org/graphics/digikam/commit/7214820504850f60679a813605cccde03449e7a9
Comment 27 Jever 2021-03-11 12:50:15 UTC
Created attachment 136584 [details]
New log of first run after install of 7.2.0

digiKam-7.2.0-20210310T200554-Win64.exe
Comment 28 Maik Qualmann 2021-03-11 13:16:22 UTC
Nice, the model could now be loaded without any problems. I would still try again with a UTF8 path as Char *. It is very unlikely that someone has a user name that cannot be resolved with the local 8-bit character table. So the cause is within OpenCV when dealing with file paths.

Maik
Comment 29 Maik Qualmann 2021-03-11 17:50:55 UTC
Git commit 4e7f2357b3255bbcb97a1de4556b5db654937989 by Maik Qualmann.
Committed on 11/03/2021 at 17:50.
Pushed by mqualmann into branch 'master'.

try with UTF8 char* as path

M  +1    -1    core/libs/facesengine/detection/opencv-dnn/dnnfacedetectorssd.cpp
M  +1    -1    core/libs/facesengine/detection/opencv-dnn/dnnfacedetectoryolo.cpp
M  +1    -1    core/libs/facesengine/recognition/opencv-dnn/dnnfaceextractor.cpp

https://invent.kde.org/graphics/digikam/commit/4e7f2357b3255bbcb97a1de4556b5db654937989
Comment 30 Maik Qualmann 2021-03-12 07:07:29 UTC
Git commit c558940789e1f4a88577785ad9658e25eed599ac by Maik Qualmann.
Committed on 12/03/2021 at 07:06.
Pushed by mqualmann into branch 'master'.

prepare for final patch and last try with UTF16 path

M  +10   -1    core/libs/facesengine/detection/opencv-dnn/dnnfacedetectorssd.cpp
M  +10   -1    core/libs/facesengine/detection/opencv-dnn/dnnfacedetectoryolo.cpp
M  +10   -1    core/libs/facesengine/recognition/opencv-dnn/dnnfaceextractor.cpp

https://invent.kde.org/graphics/digikam/commit/c558940789e1f4a88577785ad9658e25eed599ac
Comment 31 Maik Qualmann 2021-03-13 14:11:58 UTC
Git commit 82bfcdd72d04da67c300109f1ac21c6d8775f94d by Maik Qualmann.
Committed on 13/03/2021 at 14:11.
Pushed by mqualmann into branch 'master'.

use local 8 bit file path for OpenCV under Windows
FIXED-IN: 7.2.0

M  +2    -1    NEWS
M  +5    -2    core/libs/facesengine/detection/opencv-dnn/dnnfacedetectorssd.cpp
M  +5    -2    core/libs/facesengine/detection/opencv-dnn/dnnfacedetectoryolo.cpp
M  +2    -1    core/libs/facesengine/recognition/opencv-dnn/dnnfaceextractor.cpp

https://invent.kde.org/graphics/digikam/commit/82bfcdd72d04da67c300109f1ac21c6d8775f94d
Comment 32 Maik Qualmann 2021-03-13 14:15:00 UTC
Thanks again to Jever for the log files and finding the cause in private mails.

Maik