SUMMARY After closing the application be it thru the upper right-hand 'X' mark or Browse>Quit, the application can be seen remains in memory in Task Manager, but switches category from 'Apps' to 'Background Processes', with a reduction in memory usage by about a third (from 3Gb+ to 2Gb+). STEPS TO REPRODUCE 1. Open application normally. 2. After all initial scanning for new images have been completed, quit the application via upper right 'X' mark or Browse>Quit. 3. Open Microsoft Task Manager, the application can be seen still active in memory in Task Manager as 'Background Processes'. OBSERVED RESULT Application remains in memory as background processes. EXPECTED RESULT Application to shut down and remove from memory. SOFTWARE/OS VERSIONS Windows: 11 24H2 digikam: digiKam-8.7.0-20250412T170152-Qt6-Win64_exe database: mariadb ADDITIONAL INFORMATION
Hi Maik, database: mariadb : this can be the source of the problematic here ? Gilles
Further testing revealed that the application does shut down, but the time taken varies. With digikam alone, the shutting down time is about 2min45s. With other memory intensive applications in memory, such as AI photo enhancer launched immediately after quitting digikam, the time taken would be prolonged with a bit of a memory access racing signs. I have to use Task Manager's 'End Task' function to shut down digikam. My concern is would ending digikam this way affect the database integrity since I have a huge database (>100k photos). If this shut down cannot be quicken, perhaps some prompts can be given until the app totally shut down proper. Thanks in advance.
Thanks for your investigations. We have already faced by this problematic recently. 1/ Did you well uninstalled (if any) all previous versions of digiKam on your computer. 2/ Run digiKam with debugview in background to show all traces from the application shutdown. The goal is to identify where the application loop. See the notice here : https://www.digikam.org/contribute/#windows-host 3/ About the database, It's a new one, and older updated, a remote or a local version ? 4/ Did you well downloaded all the AI models files before to use digiKam. Best Gilles Caulier
(In reply to caulier.gilles from comment #3) > 1/ Did you well uninstalled (if any) all previous versions of digiKam on > your computer. *** Yes, only one version installed, usually installs using the check update option which goes thru the uninstall process of previous version. > > 2/ Run digiKam with debugview in background to show all traces from the > application shutdown. The goal is to identify where the application loop. *** Trace log from shutdown process (only digikam running on computer with other background apps such as antivirus etc): _______________________________________________________________________________________________________ # Time Debug Print 00000001 0.00000000 [5168] digikam.mlpipelinefoundation: Total Elapsed: 47807 00000002 0.00018730 [5168] digikam.facesengine: IdentityProvider::cancel: sent queue end signal 00000003 0.00043240 [5168] digikam.facesengine: IdentityProvider::trainingRemoveConcurrent thread terminated 00000004 0.00126130 [5168] digikam.geoiface: ---- 00000005 0.02382830 [5168] digikam.mlpipelinefoundation: Total Elapsed: 47831 00000006 0.02399680 [5168] digikam.mlpipelinefoundation: Total Elapsed: 47831 00000007 0.02401870 [5168] digikam.mlpipelinefoundation: Total Elapsed: 47831 00000008 0.28068849 [5168] digikam.general: Cancel Main Thread 00000009 0.28071979 [5168] digikam.general: Finish Main Thread 00000010 0.54046613 [5168] qt.multimedia.ffmpeg.mediadataholder: Could not open media. FFmpeg error description: "Immediate exit requested" 00000011 0.60441321 [5168] digikam.mlpipelinefoundation: Total Elapsed: 48412 00000012 0.85646468 [5168] kf.config.core: KConfigIni: In file C:/Users/XXXXX/AppData/Roaming/digikam/digikamstaterc, line 12: Invalid escape sequence: «\.» 00000013 0.85658967 [5168] kf.config.core: KConfigIni: In file C:/Users/XXXXX/AppData/Roaming/digikam/digikamstaterc, line 12: Invalid escape sequence: «\I» 00000014 0.85660422 [5168] kf.config.core: KConfigIni: In file C:/Users/XXXXX/AppData/Roaming/digikam/digikamstaterc, line 13: Invalid escape sequence: «\L» 00000015 0.85669249 [5168] kf.config.core: KConfigIni: In file C:/Users/XXXXX/AppData/Roaming/digikam/digikamstaterc, line 14: Invalid escape sequence: «\S» 00000016 0.85680449 [5168] kf.config.core: KConfigIni: In file C:/Users/XXXXX/AppData/Roaming/digikam/digikamstaterc, line 15: Invalid escape sequence: «\Y» 00000017 0.85690552 [5168] kf.config.core: KConfigIni: In file C:/Users/XXXXX/AppData/Roaming/digikam/digikamstaterc, line 31: Invalid escape sequence: «\1» 00000018 0.85703552 [5168] kf.config.core: KConfigIni: In file C:/Users/XXXXX/AppData/Roaming/digikam/digikamstaterc, line 56: Invalid escape sequence: «\.» 00000019 0.85706979 [5168] kf.config.core: KConfigIni: In file C:/Users/XXXXX/AppData/Roaming/digikam/digikamstaterc, line 56: Invalid escape sequence: «\I» 00000020 0.85715288 [5168] kf.config.core: KConfigIni: In file C:/Users/XXXXX/AppData/Roaming/digikam/digikamstaterc, line 57: Invalid escape sequence: «\L» 00000021 0.85733873 [5168] kf.config.core: KConfigIni: In file C:/Users/XXXXX/AppData/Roaming/digikam/digikamstaterc, line 58: Invalid escape sequence: «\S» 00000022 0.85744423 [5168] kf.config.core: KConfigIni: In file C:/Users/XXXXX/AppData/Roaming/digikam/digikamstaterc, line 59: Invalid escape sequence: «\Y» 00000023 330.09207153 [5168] digikam.facesengine: FaceClassifier::loadTrainingData: training completed in 378299 ms 00000024 330.09555054 [5168] digikam.metaengine: ExifToolProcess::shutDown(): send ExifTool shutdown command... 00000025 330.13623047 [5168] digikam.metaengine: ExifTool process finished with code: 0 and status QProcess::NormalExit 00000026 330.36117554 [5168] digikam.facedb: Remove queue destroyed 00000027 330.37310791 [5168] QWaitCondition: Destroyed while threads are still waiting _______________________________________________________________________________________________________ > 3/ About the database, It's a new one, and older updated, a remote or a > local version ? *** local machine, no remote access, updated twice I believe, last update (version 10.11) has been running fine since May 2023. > 4/ Did you well downloaded all the AI models files before to use digiKam. *** Yes. Noticed also the recent auto removal of obsolete models used by digikam.
Hi Maik, This is the line I need to fix: > 00000023 330.09207153 [5168] digikam.facesengine: FaceClassifier::loadTrainingData: training completed in 378299 ms I'm going to guess the face library is either very large, or the computer is older and slower, or maybe both. Either way, I need to kill the face training thread upon exit. The FaceClassifier uses 2 internal classifiers from OpenCV, one is a KNN classifier and the other is an SVM classifier. The long training time is due to training the SVM. Training the SVM is an opaque operation, and there isn't a function in OpenVM to cancel the training, so the other option is to kill the thread. I'll work on this once I finish updating the face menus. Cheers, Mike
Hi Mike I have the same problem. I have 220,000 faces in my database. One PC is 13 years old, the other a few months old. Closing the program can take a long time on both. But I always wait for the background process to close on its own. Regards Andy
Git commit 44f0003ec2493fdb572860024f633636a27daa45 by Michael Miller. Committed on 23/04/2025 at 20:16. Pushed by michmill into branch 'master'. terminate face training thread on exit FIXED-IN: 8.7.0 M +4 -2 core/app/main/digikamapp.cpp M +23 -0 core/libs/facesengine/recognition/faceclassifier.cpp M +2 -0 core/libs/facesengine/recognition/faceclassifier.h M +19 -6 core/libs/facesengine/recognition/identityprovider.cpp https://invent.kde.org/graphics/digikam/-/commit/44f0003ec2493fdb572860024f633636a27daa45
(In reply to Andy from comment #6) > Hi Mike > I have the same problem. I have 220,000 faces in my database. One PC is 13 > years old, the other a few months old. Closing the program can take a long > time on both. > But I always wait for the background process to close on its own. > > Regards > Andy Hi Andy, The latest commit should make digiKam exit more quickly if the FaceClassifier is what was holding it up. If the problem continues we'll start looking elsewhere. The debug trace from rb2005 shows the FaceClassifier was at least part of the issue. Cheers, Mike
Hi Mike, I've created a new output with today's build. This was created after closing digiKam. It took about a minute. https://Zunar.synology.me:55241/d/s/135XA47wWnJ8amvBAiuNaDwaIi9hTDMb/JGQ1e8c07cBjrgBEScn_wbc0Mz56uiD9-BbfgN1JeOgw Regards Andy
(In reply to Andy from comment #9) > Hi Mike, > I've created a new output with today's build. > This was created after closing digiKam. It took about a minute. > > https://Zunar.synology.me:55241/d/s/135XA47wWnJ8amvBAiuNaDwaIi9hTDMb/ > JGQ1e8c07cBjrgBEScn_wbc0Mz56uiD9-BbfgN1JeOgw > > Regards > Andy Hi Andy, Thank you for the debug log. I'm reading this correctly, the 1 minute lag from the time you closed the app until it fully exiting is much less than before. Correct? I also see the FaceClassifier didn't hold up digiKam exiting. Do you have "Settings->Miscellaneous->Behavior->Scan for new items at startup" turned on? I think this might be another contributing factor to digiKam closing quickly when digiKam hasn't been open for a while. While working on this issue, I found a few more small optimizations I can do to help both accuracy and training time. I'll check in the changes in a few minutes. Once the changes are in the new build, I'm hoping you don't mind running a few more tests for us. Your library is considerably larger than mine, and I can't replicate the tests. Cheers, Mike
Git commit be6c2aaab51d9c246187ec3f4c4ec0257cf8672c by Michael Miller. Committed on 25/04/2025 at 02:02. Pushed by michmill into branch 'master'. update SVM hyperparameters M +38 -13 core/libs/facesengine/recognition/faceclassifier.cpp M +2 -2 core/libs/facesengine/recognition/faceclassifier.h https://invent.kde.org/graphics/digikam/-/commit/be6c2aaab51d9c246187ec3f4c4ec0257cf8672c
Hello Mike, Unfortunately, I can't really say yet whether exiting has become significantly faster. The times always varied. Maybe longer if I was confirming or ignoring faces for many hours. Perhaps @rb2005 can share more information on this. "Check for new items on startup" is enabled for me. I'm happy to test the new build. But tomorrow I have to go on a 50 km march (Mega March). I won't be able to move for two days. ;-) Regards Andy
I have tested version 0418, 0425 & 0426. Both ver 0418 & 0426 seemed to exit cleanly in under 2 seconds. Ver 0425 was not working on my system, something to do with it tailored to sqlite I believe (some sql issues), and mine is mariadb. But this seemed to have resolved in ver 0426. For info, I disabled background face recognition scan in Configure>Behaviour tab, as I find the scan to kick in frequently after tagging a couple of faces and seemed to slow the app down a tad (haven't tested this in ver 0426 which I've just downloaded and not tested long enough). I hope this background scan can be changed to on demand and/or during system idle time as to not interfere with normal usage. I am also perplexed by the invalid escape sequence errors in my original debug trace. These seems to be caused by the "state=" lines in digikamstaterc, for example "State=AAAA/wAAAAD9AAAAAAAAB4AAAAOZAAAABAAAAAQAAAAIAAAACPwAAAABAAAAAgAAAAEAAAAWAG0AYQBpAG4AVABvAG8AbABCAGEAcgEAAAAA/////wAAAAAAAAAA \\.\\ISPLAY1=\\\\.\\DISPLAY1 ". I've tried to leave the "state=" blank and let the app repopulate the state, but again the escape sequence errors came back. But then it has not caused observable disruptions to the app during use. I also notice the face bounding box to be bigger now. Previously I think I've selected a face detection model other than Yunet. I hope the feature to be able to select face detection model can be brought back as the previous one I chose have tighter bounding box and not obstructing the view too much. Also, personally I found Yunet to struggle in detecting faces that are in horizontal direction or even upside down face in photos. To me, this memory bug can be considered close but I am not sure about Andy's. Thanks for solving the issue. Rgds. Rb
Hello Gilles, at https://files.kde.org/digikam/ some installation files are not updated and are still dated April 24, 2025 Regards Andy
Hi Andy, Yes, the computer at home used to run the VMs and build/upload the bundles have been perturbed by Internet disconnections due to works on street while few days. It must go back tomorrow morning when i came back at home (i'm out of town currently). Best Gilles Caulier
Test version 0427 With background face recognition scan enabled and background scan progressing at about ~30+%, image database of about 160k photos (probably 2/3 containing faces) on SSD, the shut down process (to exit code 0) took about 10s. Much of the time spent was about deleting AI pipeline packages (about 6s+). My tagging workflow is generally to tag a few representative faces of a bunch of people with background face recognition scan disabled, and only enable background scan and trigger the scan right before leaving the computer idling. This workflow is smoother imo when the database is large. For smaller database, enabling the background scan or not probably doesn't matter as the task can be performed quickly.
Hi! After 8 hours of face recognition running in the background, I closed the program. It took about 30 seconds. MariaDB remote Regards Andy
I tested again on two PCs. digiKam generally doesn't terminate the program and remains as a background process. I waited 10 minutes. Regards Andy