Bug 452268

Summary: digiKam unable to open database
Product: [Applications] digikam Reporter: AlanB <gingerlefty>
Component: Database-MysqlAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: caulier.gilles, metzpinguin
Priority: NOR    
Version First Reported In: 7.6.0   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In: 8.2.0
Sentry Crash Report:
Attachments: De Bug log

Description AlanB 2022-04-04 17:19:39 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. Open digiKam
2. 
3. 

OBSERVED RESULT
digiKam crashes

EXPECTED RESULT
digikam opens as normal

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

ADDITIONAL INFORMATION

I have in excess of 100000 images in my digikam collection and last year I migrated my database to Maria Server version on Localhost. After the migration the system has run fine until today. This morning I transferred approximately 1000 photos from my laptop to my main desktop PC.  I had been keywording the photos (using digikam on my laptop).
I transferred them using a USB stick and everything seemed to be OK.
I then ran the maintenance routine for the Album I had been using i.e. 2022 Photos, containing about 2000 images. I ticked the options for scan for new items, perform database cleaning, rebuild thumbnails and rebuild fingerprints.
As expected the process took a long time but appeared to have finished and worked, but when, several hours later i came to try and open digikam again it wouldn't open and I got the message "Error while opening the database. digiKam will try to automatically reconnect to the database." Then a new pop-up with this message "Failed to open the database. You cannot use digiKam without a working database. Please check the database settings in the next dialog."
When I checked the connection in that dialog I got the following message "Database connection test was not successful. 
Error was: Can't connect to MySQL server on '127.0.0.1' (10061) QMYSQL: Unable to connect" 
That error message refers to mysql but I can find nothing on the Mariadb website that covers it. However a Google search resulted in me checking the Services App in Windows which indicated that Maria was not running and I wasn't able to start it. Windows error message mentions a code 1 error, but I don't seem to be able find anything about it that I understand or seems relevant
Comment 1 Maik Qualmann 2022-04-04 17:42:27 UTC
Download DebugView from Microsoft. Set the Qt-Debug environment variable in the Windows environment variable editor and post the log from DebugView as described here for Windows: 

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

The error message suggests that the MySQL server is not running, a firewall is blocking the connection or something similar.

Maik
Comment 2 Maik Qualmann 2022-04-04 19:57:21 UTC
One more note about MariaDB. The currently usable MariaDB version with digiKam on Windows is maximum MariaDB-10.5.x. MariaDB-10.6.x will not work.

Maik
Comment 3 caulier.gilles 2022-04-04 19:59:52 UTC
Maik,

This will be change when Qt 5.15.3 will compile under MXE. For the moment all is broken and Qt 5.15.2 still in use.

Gilles
Comment 4 AlanB 2022-04-05 08:23:07 UTC
Maik,
Thanks for the replies.
1. Debugging- Where do I add the new user variable in the Windows system info? There seems to be rather a lot of options.
2. I downloaded the windows debugging view app but the zip file contains three exe file. I assume I use one of the 64 bit apps, but which one ? dbgview64 or dbgview64a?
3. I had tried it with the Firewall disabled before I submitted the bug report. There seemed to be no difference.
4. I upgraded to Mariadb last October (2021). I installed Mariadb on the 18/10/2021. It took a while for me to get it upgraded, in fact I ended up deleting the mysql lite databases and creating a new one with Mariadb. The point is I installed Mariadb 10.6.4 and it's worked fine until yesterday. I used Heidisql to set up the Mariadb and get it running.

Alan
Comment 5 Maik Qualmann 2022-04-05 08:51:36 UTC
There is only one environment variable editor in Windows. Type "environment variable" in the search box.

Use dbgview64.

The story with MariaDB-10.6.x is long, also on Linux. digiKam will not work stably on Windows with MariaDB-10.6.x until appropriate patches are incorporated into Qt.

If digiKam says during the connection test that no connection can be established, it is probably not digiKam's fault.

Can you establish a connection with HeidiSQL?

Maik
Comment 6 AlanB 2022-04-05 09:37:38 UTC
Thanks Maik
I have tried restarting Maria db in Heidi but didn't succeed. I'll try again.
If Mariadb 10.6 is unstable do I need to uninstall it and install 10.5? If so will I lose the digiKam database and have to start again? Will I need to do a clean reinstall of both digikam and Mariadb?

Alan
Comment 7 AlanB 2022-04-05 10:32:33 UTC
Maik
I've tried restarting Maria db with Heidi, but no luck. I get the error 10061, which seems to indicate that the db is not running as a service in Windows. But when I try to start it I get a windows error message (Code1).
From a websearch that code seems to refer to mysqldb and not Mariadb thus the "solutions" I came across don't appear to be relevant.
I have however discovered that MariadB has an error log that goes back to when I installed it. The errors over the last 2 days seem to be the same. The log shows-
2022-04-05 11:13:42 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-04-05 11:13:42 0 [Note] InnoDB: Number of pools: 1
2022-04-05 11:13:42 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2022-04-05 11:13:42 0 [Note] InnoDB: Initializing buffer pool, total size = 4294967296, chunk size = 134217728
2022-04-05 11:13:42 0 [Note] InnoDB: Completed initialization of buffer pool
2022-04-05 11:13:42 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=22603542957,22603542957
2022-04-05 11:13:42 0 [Note] InnoDB: Starting final batch to recover 3045 pages from redo log.
2022-04-05 11:13:42 0 [ERROR] InnoDB: Not applying DELETE_ROW_FORMAT_DYNAMIC due to corruption on [page id: space=10, page number=54]
2022-04-05 11:13:42 0 [ERROR] InnoDB: Set innodb_force_recovery=1 to ignore corruption.
2022-04-05 11:13:42 0 [ERROR] InnoDB: Not applying DELETE_ROW_FORMAT_DYNAMIC due to corruption on [page id: space=10, page number=54]
2022-04-05 11:13:42 0 [ERROR] InnoDB: Set innodb_force_recovery=1 to ignore corruption.
2022-04-05 11:13:42 0 [ERROR] InnoDB: Not applying DELETE_ROW_FORMAT_DYNAMIC due to corruption on [page id: space=10, page number=54]
2022-04-05 11:13:42 0 [ERROR] InnoDB: Set innodb_force_recovery=1 to ignore corruption.
2022-04-05 11:13:42 0 [ERROR] InnoDB: Not applying DELETE_ROW_FORMAT_DYNAMIC due to corruption on [page id: space=15, page number=20111]
2022-04-05 11:13:42 0 [ERROR] InnoDB: Set innodb_force_recovery=1 to ignore corruption.
2022-04-05 11:13:42 0 [ERROR] InnoDB: Not applying INSERT_HEAP_DYNAMIC due to corruption on [page id: space=29, page number=6]
2022-04-05 11:13:42 0 [ERROR] InnoDB: Set innodb_force_recovery=1 to ignore corruption.
2022-04-05 11:13:42 0 [ERROR] InnoDB: Plugin initialization aborted with error Data structure corruption
2022-04-05 11:13:42 0 [Note] InnoDB: Starting shutdown...
2022-04-05 11:13:43 0 [ERROR] Plugin 'InnoDB' init function returned error.
2022-04-05 11:13:43 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2022-04-05 11:13:43 0 [Note] Plugin 'FEEDBACK' is disabled.
2022-04-05 11:13:43 0 [ERROR] Unknown/unsupported storage engine: InnoDB
2022-04-05 11:13:43 0 [ERROR] Aborting

Don't know if this helps.

Alan
Comment 8 AlanB 2022-04-05 16:25:55 UTC
Created attachment 147985 [details]
De Bug log
Comment 9 Maik Qualmann 2022-04-05 16:39:16 UTC
There is no MySQL server available. According to the error messages in the MySQL log, there is a serious error in the MySQL server's own administration table. The MySQL server crashes on startup. The cause? Could be a bug in MariaDB or a hard drive issue. Be sure to check the drive for errors. You will have to start with a completely new MySQL server.

Maik
Comment 10 AlanB 2022-04-05 19:58:37 UTC
Thanks Maik.

I've checked the HD, which is 125Gb SSD and there are no errors.
One last question , if you don't mind. I have a Disk Image of that SSD that contains most of my apps and the Mariadb, but none of my photos which I back up separately. If I mount that Disk Image and copy the relevant folders back to the SSD is there a possibility that would solve the problem?

Alan
Comment 11 AlanB 2022-04-06 10:08:28 UTC
Hi Maik

After you confirmed that the problem was with Mariadb and not digiKam I did some further research on t'internet and after reading some comments and altering one or two things I, eventually, was able to rerun the Mariadb installer I originally used (10.6.4) and the repair option did just that, it repaired the installation and allowed digiKam to access the database. All the items I had added to digiKam on the 4th were missing and the album had to be refreshed to re-integrate them into the album.
I'm also led to believe that I can't move the version backwards to 10.5.x and continue to use the current database, so I've decided to continue with 10.6 and hope the problems are solved. I've used it for 6 months with no problems until now.
Thanks once again for your help and sorry I had to bother you with a problem that turned out not to be caused by digiKam.

Alan
Comment 12 caulier.gilles 2023-04-19 05:58:58 UTC
@AlanB

digiKam 8.0.0 is released. This file still valid ?

Gilles Caulier
Comment 13 caulier.gilles 2023-10-15 09:52:08 UTC
@AlanB,

This problem still reproducible with the new digiKam 8.2.0 pre-release Windows
installer available at usual place:

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

This new bundle is based on last Qt framework 5.15.11 and KDE framework 5.110.

Thanks in advance

Gilles Caulier
Comment 14 Maik Qualmann 2023-10-20 21:10:43 UTC
Fixed with Bug 475874

Maik