alliedmodders / sourcemod

SourceMod - Source Engine Scripting and Administration
http://www.sourcemod.net/
974 stars 422 forks source link

Clientprefs crashes when MySQL connection fails #1576

Closed Adrianilloo closed 2 years ago

Adrianilloo commented 3 years ago

After reading #1207 and the referenced crashes of "particular interest" (quoting), I'd like to report a more unique, reproducible case that is affecting me and doesn't apparently fit to these referenced cases already being considered (even if it may share common roots, which I don't know).

So, I've been using a free remote MySQL service that's currently down. Under this downtime condition, the following actions happen to eventually crash the server (game is HL2:DM):

  1. Have a properly configured connection for the aforementioned MySQL service at databases.cfg
  2. Start the server
  3. Join it and change/reload map
  4. Wait few minutes (presummably the time it takes the driver to be notified that the service is down, overall)
  5. (Crash at dbi.mysql.ext.so!Connect)

This seems to be reproducible always. I also left the server with default plugins and no other custom Metamod/base addons at all, and the same issue happened:

meta list
Listing 2 plugins:
  [01] SourceMod (1.10.0.6510) by AlliedModders LLC
  [02] SDK Tools (1.10.0.6510) by AlliedModders LLC
sm exts list
[SM] Displaying 5 extensions:
[01] Top Menus (1.10.0.6510): Creates sorted nested menus
[02] SDK Tools (1.10.0.6510): Source SDK Tools
[03] BinTools (1.10.0.6510): Low-level C/C++ Calling API
[04] Client Preferences (1.10.0.6510): Saves client preference settings
[05] MySQL-DBI (1.10.0.6510): MySQL driver implementation for DBI
sm plugins list
[SM] Listing 20 plugins:
  01 "RandomCycle" (1.10.0.6510) by AlliedModders LLC
  02 "Anti-Flood" (1.10.0.6510) by AlliedModders LLC
  03 "Basic Ban Commands" (1.10.0.6510) by AlliedModders LLC
  04 "Fun Votes" (1.10.0.6510) by AlliedModders LLC
  05 "Admin Menu" (1.10.0.6510) by AlliedModders LLC
  06 "Player Commands" (1.10.0.6510) by AlliedModders LLC
  07 "Rock The Vote" (1.10.0.6510) by AlliedModders LLC
  08 "Sound Commands" (1.10.0.6510) by AlliedModders LLC
  09 "Map Nominations" (1.10.0.6510) by AlliedModders LLC
  10 "Admin Help" (1.10.0.6510) by AlliedModders LLC
  11 "MapChooser" (1.10.0.6510) by AlliedModders LLC
  12 "Basic Chat" (1.10.0.6510) by AlliedModders LLC
  13 "Admin File Reader" (1.10.0.6510) by AlliedModders LLC
  14 "Basic Votes" (1.10.0.6510) by AlliedModders LLC
  15 "Basic Commands" (1.10.0.6510) by AlliedModders LLC
  16 "Client Preferences" (1.10.0.6510) by AlliedModders LLC
  17 "Reserved Slots" (1.10.0.6510) by AlliedModders LLC
  18 "Basic Comm Control" (1.10.0.6510) by AlliedModders LLC
  19 "Basic Info Triggers" (1.10.0.6510) by AlliedModders LLC
  20 "Fun Commands" (1.10.0.6510) by AlliedModders LLC

See related stacktrace.

If you need anything else ask me, I'll share the full stack trace given the SteamID to anyone interested (you can also add me in Steam or Discord by the name Adrián#5039).

Thanks a lot.

asherkin commented 3 years ago

This is the crashing form of #778 - which is clientprefs losing it's database config reference and passing garbage into the DBI layer. It is mentioned as an aside in #1207, but it's an issue in clientprefs rather than the mysql driver.

Clientprefs doesn't use MySQL by default, what do you have configured in your databases.cfg?

Adrianilloo commented 3 years ago

This is/was my databases.cfg with the affected MySQL service (I'm using SQLite3 temporarily now):

"Databases"
{
    "driver_default" "mysql"

    "default"
    {
        "host"      "remotemysql.com"
        "database"  "<db>"
        "user"      "<user>"
        "pass"      "<pass>"
    }
}

(It's as is, there aren't more omitted connections)

Adrianilloo commented 2 years ago

This seems to have been fixed now for me. When related MySQL service is down, I see the following message in console:

L 09/10/2022 - 14:07:01: [CLIENTPREFS] [2002]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

And then changing map works fine, without crashing. I guess #1135 fixed it.