Bug 455031 - Database process exited unexpectedly during initial connection.
Summary: Database process exited unexpectedly during initial connection.
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Database-Mysql (show other bugs)
Version: 8.0.0
Platform: Arch Linux Linux
: NOR crash
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-06-08 13:57 UTC by battyanyi.dani
Modified: 2023-10-20 21:12 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 8.2.0
Sentry Crash Report:
battyanyi.dani: Backport+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description battyanyi.dani 2022-06-08 13:57:00 UTC
SUMMARY
***
Unable to start digikam with Mysql (MariaDB) internal database, database creation also fails. Works with SQLite.
I've tried it with digikam 7.6.0 and 8.0.0 where 7.6.0 was installed using the pacman package manager and 8.0.0 was compiled from source using the instructions on the website.

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 without a database
2.  Get to the database creation screen
2.  Set database type to Mysql Internal and create the database.
3.  Click OK
4.  Sends error message

OBSERVED RESULT
Fails to load/create database

EXPECTED RESULT
Loads/creates database

SOFTWARE/OS VERSIONS

Operating System: Arch Linux
KDE Plasma Version: 5.24.5
KDE Frameworks Version: 5.94.0
Qt Version: 5.15.4
Kernel Version: 5.18.1-arch1-1 (64-bit)
Graphics Platform: X11
mariadb  Ver 15.1 Distrib 10.8.3-MariaDB, for Linux (x86_64) using readline 5.1

ADDITIONAL INFORMATION

This is what i get after "export QT_LOGGING_RULES="digikam*=true""

digikam.qtavwidgets: Register QtAV Renderers
digikam.widgets: Use installed icons
digikam.general: "/home/dani/Pictures"
digikam.general: Testing  "mysql_install_db" ...
digikam.general: Found  "mysql_install_db"
digikam.general: Testing  "mysqladmin" ...
digikam.general: Found  "mysqladmin"
digikam.general: Testing  "mysqld" ...
digikam.general: Found  "mysqld"
digikam.general: Root album is :  "/home/dani/Pictures"
digikam.database: Database directory is :  "/home/dani/Pictures"
digikam.dbengine: Loading SQL code from config file "/usr/share/digikam/database/dbconfig.xml"
digikam.dbengine: Checking XML version ID => expected:  3  found:  3
digikam.dbengine: ConnectOptions  "UNIX_SOCKET=/home/dani/.local/share/digikam/db_misc/mysql.socket"
digikam.dbengine: ConnectOptions  "UNIX_SOCKET=/home/dani/.local/share/digikam/db_misc/mysql.socket"
digikam.general: Switch to widget style:  "Fusion"
digikam.general: AlbumWatch is disabled
digikam.general: Database Parameters:
   Type:                      "QMYSQL"
   DB Core Name:              "digikam"
   DB Thumbs Name:            "digikam"
   DB Face Name:              "digikam"
   DB Similarity Name:        "digikam"
   Connect Options:           "UNIX_SOCKET=/home/dani/.local/share/digikam/db_misc/mysql.socket"
   Host Name:                 ""
   Host port:                 -1
   Internal Server:           true
   Internal Server Path:      "/home/dani/Pictures"
   Internal Server Admin Cmd: "mysqladmin"
   Internal Server Serv Cmd:  "mysqld"
   Internal Server Init Cmd:  "mysql_install_db"
   Username:                  "root"
   Password:                  ""

digikam.databaseserver: Database Parameters:
   Type:                      "QMYSQL"
   DB Core Name:              "digikam"
   DB Thumbs Name:            "digikam"
   DB Face Name:              "digikam"
   DB Similarity Name:        "digikam"
   Connect Options:           "UNIX_SOCKET=/home/dani/.local/share/digikam/db_misc/mysql.socket"
   Host Name:                 ""
   Host port:                 -1
   Internal Server:           true
   Internal Server Path:      "/home/dani/Pictures"
   Internal Server Admin Cmd: "mysqladmin"
   Internal Server Serv Cmd:  "mysqld"
   Internal Server Init Cmd:  "mysql_install_db"
   Username:                  "root"
   Password:                  ""

digikam.databaseserver: Internal Server data path: "/home/dani/Pictures/.mysql.digikam/db_data"
digikam.databaseserver: The mysql configuration was already up-to-date: "/home/dani/.local/share/digikam/mysql.conf"
digikam.databaseserver: Database server: "mysqld" ("--defaults-file=/home/dani/.local/share/digikam/mysql.conf", "--datadir=/home/dani/Pictures/.mysql.digikam/db_data", "--socket=/home/dani/.local/share/digikam/db_misc/mysql.socket")
digikam.databaseserver: "Database process exited unexpectedly during initial connection."
digikam.databaseserver: Executable: "mysqld"
digikam.databaseserver: Arguments: "--defaults-file=/home/dani/.local/share/digikam/mysql.conf, --datadir=/home/dani/Pictures/.mysql.digikam/db_data, --socket=/home/dani/.local/share/digikam/db_misc/mysql.socket"
digikam.databaseserver: Stdout: ""
digikam.databaseserver: Stderr: "2022-06-08 13:23:42 0 [Note] /usr/bin/mysqld (server 10.8.3-MariaDB-log) starting as process 12931 ...\n"
digikam.databaseserver: Exit code: 1
digikam.databaseserver: Process error: "Unknown error"
digikam.databaseserver: Cannot start internal database server
Comment 1 Maik Qualmann 2022-06-08 14:37:08 UTC
digiKam-8.0.0 from git/master is alpha status. Only use it if you know what you are doing and not in a productive environment. It is currently not tested with MariaDB-10.8.x.

Maik
Comment 2 Maik Qualmann 2022-06-08 14:44:40 UTC
You know that MariaDB-10.8.3 is alpha and not intended to be used in production environment? The digiKam log looks like a crash in MariaDB. Please send a complete log to see the database creation.

Maik
Comment 3 battyanyi.dani 2022-06-09 18:06:08 UTC
(In reply to Maik Qualmann from comment #2)
> You know that MariaDB-10.8.3 is alpha and not intended to be used in
> production environment? The digiKam log looks like a crash in MariaDB.
> Please send a complete log to see the database creation.
> 
> Maik

(In reply to Maik Qualmann from comment #1)
> digiKam-8.0.0 from git/master is alpha status. Only use it if you know what
> you are doing and not in a productive environment. It is currently not
> tested with MariaDB-10.8.x.
> 
> Maik

I've tried it after the stable release version didn't work to check if the alpha version works better. Switched back to 7.6.0 when it failed as well.
Comment 4 battyanyi.dani 2022-06-09 18:09:21 UTC
(In reply to Maik Qualmann from comment #2)
> You know that MariaDB-10.8.3 is alpha and not intended to be used in
> production environment? The digiKam log looks like a crash in MariaDB.
> Please send a complete log to see the database creation.
> 
> Maik

Do you mean the mariadb log?  If so, where can I find it?
Comment 5 battyanyi.dani 2022-06-09 18:59:53 UTC
I've been playing around with it for a little bit, and as it turns out if i delete/rename all of these:

~/.local/share/digikam/db_misc/mysql.socket
~/Pictures/.mysql.digikam/
~/.local/share/digikam/mysql.conf
~/.config/digikamrc,

it succeeds in creating the database, but crashes when clicking "configure digikam" . 

[warn] epoll_wait: Bad file descriptor
pa_write() failed while trying to wake up the mainloop: Bad file descriptor
pa_write() failed while trying to wake up the mainloop: Bad file descriptor
Invalid write to eventfd: Bad file descriptor
[warn] epoll_wait: Bad file descriptor
[warn] epoll_wait: Bad file descriptor
[warn] epoll_wait: Bad file descriptor
[warn] epoll_wait: Bad file descriptor
Code should not be reached at ../pulseaudio/src/pulsecore/fdsem.c:188, function pa_fdsem_post(). Aborting.
[warn] epoll_wait: Bad file descriptor

Thread 36 "digikam" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fff6d7fa640 (LWP 1312231)]
0x00007ffff4a8e36c in ?? () from /usr/lib/libc.so.6

After that, on the  second start digikam works fine, but on the third start it runs into the database problem. If the program exits correctly it fails to load the database after restarting it.
Comment 6 battyanyi.dani 2022-06-09 19:07:20 UTC
(In reply to battyanyi.dani from comment #5)
> I've been playing around with it for a little bit, and as it turns out if i
> delete/rename all of these:
> 
> ~/.local/share/digikam/db_misc/mysql.socket
> ~/Pictures/.mysql.digikam/
> ~/.local/share/digikam/mysql.conf
> ~/.config/digikamrc,
> 
> it succeeds in creating the database, but crashes when clicking "configure
> digikam" . 
> 
> [warn] epoll_wait: Bad file descriptor
> pa_write() failed while trying to wake up the mainloop: Bad file descriptor
> pa_write() failed while trying to wake up the mainloop: Bad file descriptor
> Invalid write to eventfd: Bad file descriptor
> [warn] epoll_wait: Bad file descriptor
> [warn] epoll_wait: Bad file descriptor
> [warn] epoll_wait: Bad file descriptor
> [warn] epoll_wait: Bad file descriptor
> Code should not be reached at ../pulseaudio/src/pulsecore/fdsem.c:188,
> function pa_fdsem_post(). Aborting.
> [warn] epoll_wait: Bad file descriptor
> 
> Thread 36 "digikam" received signal SIGABRT, Aborted.
> [Switching to Thread 0x7fff6d7fa640 (LWP 1312231)]
> 0x00007ffff4a8e36c in ?? () from /usr/lib/libc.so.6
> 
> After that, on the  second start digikam works fine, but on the third start
> it runs into the database problem. If the program exits correctly it fails
> to load the database after restarting it.


"After that, on the  second start digikam works fine, but on the third start
it runs into the database problem. If the program exits correctly it fails to load the database after restarting it."

This last part is resolved by not deleting  the "~/.local/share/digikam/db_misc/mysql.socket" file, only the rest of the ones above.

Currently testing whether  this resolves the issue completely.
Comment 7 Maik Qualmann 2022-06-10 06:40:47 UTC
Here on openSUSE Tumbleweed with MariaDB-10.7.3 and digiKam-8.0.0 there are no problems with the database.

Maik
Comment 8 battyanyi.dani 2022-06-13 20:09:09 UTC
(In reply to Maik Qualmann from comment #7)
> Here on openSUSE Tumbleweed with MariaDB-10.7.3 and digiKam-8.0.0 there are
> no problems with the database.
> 
> Maik

I ended up resolving the issue by downgrading mariadb to version 10.7.4. It has been working ever since.
Thank you for your help :).
Comment 9 Antonio Rojas 2022-06-15 17:54:41 UTC
(In reply to Maik Qualmann from comment #2)
> You know that MariaDB-10.8.3 is alpha and not intended to be used in
> production environment? The digiKam log looks like a crash in MariaDB.
> Please send a complete log to see the database creation.
> 
> Maik

No, mariadb 10.8.3 is a stable release.

https://mariadb.org/mariadb/all-releases/
Comment 10 Maik Qualmann 2022-06-15 18:10:37 UTC
I also found a bug report for Akonadi on Archlinux. Is there any knowledge as to what the cause is? It looks like the database needs to be upgraded. digiKam, has detected from the MySQL error log whether an upgrade needs to be performed. We will probably have to set up a manual method for the user to initiate the upgrade.

This issue relates to an internal MariaDB database managed by digiKam.

Maik
Comment 11 Maik Qualmann 2022-06-15 18:17:49 UTC
Ok, I see this option "mariadb-upgrade --check-if-upgrade-is-needed". We can do something with that if it's the cause.

Maik
Comment 12 Antonio Rojas 2022-06-15 18:18:20 UTC
(In reply to Maik Qualmann from comment #10)
> I also found a bug report for Akonadi on Archlinux. Is there any knowledge
> as to what the cause is? It looks like the database needs to be upgraded.
> digiKam, has detected from the MySQL error log whether an upgrade needs to
> be performed. We will probably have to set up a manual method for the user
> to initiate the upgrade.

The akonadi issue is caused by a missing ib_logfile0 file, which is mandatory in mariadb 10.8. No idea if this issue is related.

See https://bugs.kde.org/show_bug.cgi?id=454948#c16
Comment 13 Maik Qualmann 2022-06-15 18:20:50 UTC
Hmm, we remove exactly this log file before we start the server...

Maik
Comment 14 Maik Qualmann 2022-06-15 18:35:32 UTC
Git commit 8d16ea2e3fddbfa9a1615d506c342070502d1ce9 by Maik Qualmann.
Committed on 15/06/2022 at 18:26.
Pushed by mqualmann into branch 'master'.

do not remove the MySQL log files

M  +2    -2    core/libs/database/server/databaseserver.cpp

https://invent.kde.org/graphics/digikam/commit/8d16ea2e3fddbfa9a1615d506c342070502d1ce9
Comment 15 Antonio Rojas 2022-06-15 19:05:36 UTC
Arch users please test digikam 7.6.0-5
Comment 16 caulier.gilles 2023-04-19 05:54:59 UTC
@battyanyi.dani@gmail.com

digiKam 8.0.0 is released. This file still valid ?

Gilles Caulier
Comment 17 caulier.gilles 2023-10-11 05:48:03 UTC
@ battyanyi.dani@gmail.com,

What's about this file using current 8.2.0 AppImage Linux bundle ? It's
reproducible ?

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

Thanks in advance

Gilles Caulier
Comment 18 Maik Qualmann 2023-10-20 21:12:27 UTC
Fixed with Bug 475874

Maik