Your application (TFS, meaning The Forgotten Server or its fork) tried to send data (for example, to a MySQL database through libmysqlclient), but the connection was lost.
And my question is — why?
That may be true. It's lost, because TFS 1.x has 2 connections to MySQL/MariaDB. One used by 99% of code (synchronous - load players, save player etc.) and one used by some Lua scripts and some parts of Tibia Market (asynchronous).
MySQL has a default timeout for inactive connections and drops them after reaching it. It's controlled by 2 MySQL config variables:
interactive_timeout
wait_timeout
and both are set to 8 hours by default (28800 seconds):
MySQL Timeout Explained (https://www.bytebase.com/blog/mysql-timeout/#interactivetimeout-and-waittimeout)
It may also happen on server with just 1 connection to MySQL (ex. TFS 0.4), when there is no players for 8 hours and no Lua script that loads/saves something in database, but in your case it crashed on
DatabaseTasks::runTask, which is function for 'asynchronous queries'.
On Linux with MariaDB you can set them in
/etc/mysql/mariadb.conf.d/50-server.conf. On other systems or using MySQL (in place of MariaDB) - IDK, ask some AI, it should be easy to edit.
THERE IS ALSO OTHER POSSIBILITY // it may be unrelated coincidence
In your crash report there are 2 C++ threads executing MySQL queries at same time:
Thread 4 (async - database thread) executing DELETE FROM `player_deaths` WHERE `player_id` = 13 ORDER BY `time` LIMIT 1
Thread 2 (sync - dispatcher thread) executing UPDATE `players` SET `level` = 248,`group_id` = 1,`vocation` = 7,`health` = 2795,`healthmax` = 2795,`experience` = 250485922,`lookbody` = 102,`lookfeet` = 95,`lookhead` = 132,`looklegs` = 116,`looktyp`
They use other
Database objects, but it's possible that they use same MySQL connection.
Sooome old servers had a bug that made 2 threads use MySQL connection, but there was only 1 connection and no
mutex to prevent 2 threads from using it in same time.
On latest TFS it's implemented with
databaseLock:
A free and open-source MMORPG server emulator written in C++ - otland/forgottenserver
github.com
A free and open-source MMORPG server emulator written in C++ - otland/forgottenserver
github.com
On TFS 1.0 it was also implemented with
database_lock:
A free and open-source MMORPG server emulator written in C++ - otland/forgottenserver
github.com
A free and open-source MMORPG server emulator written in C++ - otland/forgottenserver
github.com
I would increase default timeout for inactive connections in MySQL to value like 30 days and wait for next crash - if it happens.