Description
Summary
When backing up a huge MariaDB database (for openHAB) I get the following error:
mariadb-dump: Error 2013: Lost connection to server during query when dumping table Item144 at row: 331906
The error is not the problem. The problem is that there are no notifications. Also a file is in the backup directory, everything looks normal - except the file size.
Steps to reproduce
See above.
What is the expected correct behavior?
Triggered notifications which bring this error to the attention of the user.
Relevant logs and/or screenshots
I only see this error in the Docker logs:
mariadb-dump: Error 2013: Lost connection to server during query when dumping table
Item144 at row: 331906
Interesting is that it cannot be seen in /var/log/container.container.log inside the container. There I only see this:
2025-01-26.04:02:09 [NOTICE] /etc/services.available/dbbackup-01/run ** [01-x.x.x.x__ALL] Dumping MySQL/MariaDB database: 'openhab' and compressing with 'zstd'
2025-01-26.04:05:29 [DEBUG] /etc/services.available/dbbackup-01/run ** [01-x.x.x.x__ALL] DB Backup exit Code is 0
2025-01-26.04:05:29 [INFO] /etc/services.available/dbbackup-01/run ** [01-x.x.x.x__ALL] DB Backup of 'mariadb_openhab_x.x.x.x_20250126-040209.sql.zst' completed successfully
2025-01-26.04:05:29 [NOTICE] /etc/services.available/dbbackup-01/run ** [01-x.x.x.x__ALL] Backup of 'mariadb_openhab_x.x.x.x_20250126-040209.sql.zst' created with the size of 21970228 bytes
2025-01-26.04:05:29 [DEBUG] /etc/services.available/dbbackup-01/run ** [01-x.x.x.x__ALL] Moving backup to filesystem
2025-01-26.04:05:29 [DEBUG] /etc/services.available/dbbackup-01/run ** [01-x.x.x.x__ALL] Move exit Code is 0
2025-01-26.04:05:30 [DEBUG] /etc/services.available/dbbackup-01/run ** [01-x.x.x.x__ALL] Moving of backup 'mariadb_openhab_x.x.x.x_20250126-040209.sql.zst' completed successfully
2025-01-26.04:05:30 [NOTICE] /etc/services.available/dbbackup-01/run ** [01-x.x.x.x__ALL] DB Backup for 'openhab' time taken: Hours: 0 Minutes: 03 Seconds: 21
As I see an exit code 0 it looks like the error is not catched. It only shows in Docker errors and before other "interesting" logs:
As mentioned, the error is not the problem, but that it is not reported and there might be backups not working or incomplete. For myself, I have mail and Matrix notifications configured, at least mail should work as I sent some test mails out of the container.
I wil also try to get around the error - also because this more likely seems to be a server problem, and not so much of the client (db-backup). Google says, I shoud put max_allowed_packet from 16MB to 1G in [mysqld]
and [mysqldump]
sections, which I will try.
max_allowed_packet = 1G
Others write that I should play with timeout values. I will also try, but one after the other.
Environment
- Image version / tag: latest
- Host OS: Unraid