Sometimes when I try to connect to my server, I get “database error”. When I check the logs of the TeamSpeak container, here’s what gets logged: 2024-11-16 10:04:21.042771|ERROR |DatabaseQuery | |db_open() select * from clients where client_unique_id = '[REDACTED ID] error: Lost connection to MySQL server during query. When I try to connect 3 or 4 times in a row I can successfully connect. Where is this error from and how can I solve it?
I updated my database. Here are the database logs—which look fine:
2025-06-16 15:44:55+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:11.8.2+maria~ubu2404 started.
2025-06-16 15:44:56+00:00 [Warn] [Entrypoint]: /sys/fs/cgroup///memory.pressure not writable, functionality unavailable to MariaDB
2025-06-16 15:44:56+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2025-06-16 15:44:56+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:11.8.2+maria~ubu2404 started.
2025-06-16 15:44:56+00:00 [Note] [Entrypoint]: MariaDB upgrade (mariadb-upgrade or creating healthcheck users) required, but skipped due to $MARIADB_AUTO_UPGRADE setting
2025-06-16 15:44:56 0 [Note] Starting MariaDB 11.8.2-MariaDB-ubu2404 source revision 8d36cafe4fc700e6e577d5a36650c58707e76b92 server_uid VP/n9WIkiT8akEqUXEqJeE45qkk= as process 1
2025-06-16 15:44:59 0 [Note] InnoDB: Compressed tables use zlib 1.3
2025-06-16 15:44:59 0 [Note] InnoDB: Using transactional memory
2025-06-16 15:44:59 0 [Note] InnoDB: Number of transaction pools: 1
2025-06-16 15:44:59 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2025-06-16 15:44:59 0 [Note] mariadbd: O_TMPFILE is not supported on /tmp (disabling future attempts)
2025-06-16 15:44:59 0 [Warning] mariadbd: io_uring_queue_init() failed with EPERM: sysctl kernel.io_uring_disabled has the value 2, or 1 and the user of the process is not a member of sysctl kernel.io_uring_group. (see man 2 io_uring_setup).
2025-06-16 15:44:59 0 [Warning] InnoDB: liburing disabled: falling back to innodb_use_native_aio=OFF
2025-06-16 15:44:59 0 [Note] InnoDB: innodb_buffer_pool_size_max=128m, innodb_buffer_pool_size=128m
2025-06-16 15:44:59 0 [Note] InnoDB: Completed initialization of buffer pool
2025-06-16 15:44:59 0 [Note] InnoDB: Buffered log writes (block size=512 bytes)
2025-06-16 15:44:59 0 [Note] InnoDB: End of log at LSN=71630124
2025-06-16 15:45:04 0 [Note] InnoDB: Opened 3 undo tablespaces
2025-06-16 15:45:04 0 [Note] InnoDB: 128 rollback segments in 3 undo tablespaces are active.
2025-06-16 15:45:04 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
2025-06-16 15:45:04 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
2025-06-16 15:45:04 0 [Note] InnoDB: log sequence number 71630124; transaction id 3724
2025-06-16 15:45:04 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2025-06-16 15:45:04 0 [Note] Plugin 'FEEDBACK' is disabled.
2025-06-16 15:45:04 0 [Note] Plugin 'wsrep-provider' is disabled.
2025-06-16 15:45:04 0 [Note] InnoDB: Buffer pool(s) load completed at 250616 15:45:04
2025-06-16 15:45:06 0 [Note] Server socket created on IP: '0.0.0.0'.
2025-06-16 15:45:06 0 [Note] Server socket created on IP: '::'.
2025-06-16 15:45:06 0 [Note] mariadbd: Event Scheduler: Loaded 0 events
2025-06-16 15:45:06 0 [Note] mariadbd: ready for connections.
Version: '11.8.2-MariaDB-ubu2404' socket: '/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution
But the TeamSpeak server logs look less fine:
2025-06-16 14:45:47.837864|ERROR |DatabaseQuery | |db_open() select distinct c.client_id, c.server_id from (clients c left outer jo error: Lost connection to MySQL server during query
As I was about to post this message, I realized that Telegraf could be the culprit, so I stopped the service and now I don’t get any errors for connecting. I won’t post my Telegraf configuration here as I think it’s not related to TeamSpeak and would not really be relevant for the TeamSpeak team.
I guess Telegraf was flooding the TeamSpeak server or eating up all connections in the pool. I’m going to dive into it later, but I hope my findings can also help someone down the road.
I sincerely apologize but I don’t understand which instance you’re talking about. How do I "leave socket= blank and where? And on which service and where do I set host=localhost?
This would be in the ts3db_mariadb.ini but as you’re using Docker this does not seem to exist right?
I was searching through the forums and found a post about a similar issue as most of the devs are off due to public holidays. But that does not seem to be working for this case.
Perhaps try ts3db_sqlite3 or ts3db_postgresql instead.
The former is local and does not require an additional container, which probably eliminates the issue.
I will try this as soon as I get back home. I’m just going to delete the TeamSpeak volume and not bother with the migration. I don’t have any important data.
If I use SQLite, do you know the location of the .sqlite file inside the TeamSpeak container?
Thank you for providing the example and going to such lengths to help me.
Did you let it run for a few hours before trying to connect again? I usually can connect just fine if the server just started; after a few hours, problems start to appear.