[X] I have tried my absolute best to reduce the problem-space and have provided the absolute smallest test-case possible.
[X] I can always reproduce the issue with the provided description below.
Environment
Operating System version: Ubuntu server
Game/AppID (with version if applicable): CSGO/730
Current SourceMod version: 1.11.0.6808
Current Metamod: Source snapshot: 1.11.0-dev+1130
[X] I have updated SourceMod to the latest version and it still happens.
[X] I have updated SourceMod to the latest snapshot and it still happens.
[X] I have updated SourceMM to the latest snapshot and it still happens.
Description
I found this issue when was investigating random crashes on map change on a CSGO server. It turned out that the reason was a "reloader" plugin which would reload all smx plugins on map change. Another reason was unstable connection to the database server which was used by some of the plugins. The server would crash 1-2 times a day.
I guess, if a plugin is reloaded while it is executing a threaded SQL query, the query is turned into non-threaded and, if the query can't be executed because of communication problems with the database, it freezes the server.
On adding the example plugin to one of my servers it crashes after a few seconds without any information in the crash stack, but I suppose that the watchdog kills it, another server just freezes for 30 seconds.
If my assumption is correct, to solve this problem I would suggest:
dropping all the queries instead of turning them into non-threaded. The lost information is not importent.
keep all the queries asynchronous and postpone reloading till all the queries are executed.
If these are not the ways, it would be nice to have some information about such crashes in the logs.
The root of the problem as I can see is in function DBManager::OnPluginWillUnload.
Make sure the database address in the server configuration is INcorrect before running the example:
DBCrashTest.zip
To reproduce the problem:
1) Start the plugin.
2) Wait till it shows the MySQL connection problem message.
3) Reload it two times in a row before it shows the MySQL connection problem message -> the server crashes in 15 seconds.
For convenience I added ServerCommand from the reloader plugin for automatic plugin reloading, but in my case it mostly leads to 30sec freezes.
Help us help you
Environment
Description
I found this issue when was investigating random crashes on map change on a CSGO server. It turned out that the reason was a "reloader" plugin which would reload all smx plugins on map change. Another reason was unstable connection to the database server which was used by some of the plugins. The server would crash 1-2 times a day. I guess, if a plugin is reloaded while it is executing a threaded SQL query, the query is turned into non-threaded and, if the query can't be executed because of communication problems with the database, it freezes the server. On adding the example plugin to one of my servers it crashes after a few seconds without any information in the crash stack, but I suppose that the watchdog kills it, another server just freezes for 30 seconds. If my assumption is correct, to solve this problem I would suggest:
If these are not the ways, it would be nice to have some information about such crashes in the logs. The root of the problem as I can see is in function DBManager::OnPluginWillUnload.
Make sure the database address in the server configuration is INcorrect before running the example: DBCrashTest.zip
To reproduce the problem: 1) Start the plugin. 2) Wait till it shows the MySQL connection problem message. 3) Reload it two times in a row before it shows the MySQL connection problem message -> the server crashes in 15 seconds.
For convenience I added ServerCommand from the reloader plugin for automatic plugin reloading, but in my case it mostly leads to 30sec freezes.