alliedmodders / sourcemod

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

OnDBConnect - Could not find database config after moving 6267 -> 6331 #882

Closed dragokas closed 6 years ago

dragokas commented 6 years ago

Help us help you

Environment

Description

After updating server from 1.10.0.6267 to 1.10.0.6331, I'm receiving such error:

L 09/11/2018 - 10:09:00: [vip/VIP_Core.smx] OnLibraryAdded: vip_core
L 09/11/2018 - 10:09:00: [SM] Exception reported: OnDBConnect Could not find database config "vip"
L 09/11/2018 - 10:09:00: [SM] Blaming: vip/VIP_Core.smx
L 09/11/2018 - 10:09:00: [SM] Call stack trace:
L 09/11/2018 - 10:09:00: [SM]   [0] SetFailState
L 09/11/2018 - 10:09:00: [SM]   [1] Line 41, vip/db.sp::OnDBConnect

I checked it twice. After reverting bin, extensions and plugins files back to 1.10.0.6267, connection is OK.

Problematic Code (or Steps to Reproduce)

I dunno, just ask what you need. Here is a plugin. No sources. -REMOVED-

Headline commented 6 years ago

You must give the source if you are going to distribute the plugin binary. I removed your link

edit: can you show what your database.cfg looks like? Please ensure you blank out sensitive information

dragokas commented 6 years ago

You must give the source if you are going to distribute the plugin binary. I removed your link

I'm not going to distribute. It was for your conveniences. But if you don't need it, you are the boss.

edit: can you show what your database.cfg looks like? Please ensure you blank out sensitive information

Please, databases.zip

Headline commented 6 years ago

@dragokas in the config you uploaded it doesn't appear that vip has an entry in the databases.cfg, which is what the error indicates. Adding the configuration into the file should resolve this problem

asherkin commented 6 years ago

Please post at least the entire vip/db.sp::OnDBConnect function.

asherkin commented 6 years ago

This is a duplicate of #865.

dragokas commented 6 years ago

Headline, I also see that there are no "vip" cfg. But I see what I see, with previous build it work ok (database.cfg file is untoched and was the same for both cases).

Headline commented 6 years ago

asherkin and I have confirmed that this is a duplicate of #865, and is still a sourcemod bug. It will be fixed in the coming week(s)

dragokas commented 6 years ago
DB_Connect()
{
    if (g_iClientInfo[0] & 4)
    {
        return 0;
    }
    if (g_hDatabase)
    {
        new var1 = g_iClientInfo;
        var1[0] = var1[0] & -5;
        return 0;
    }
    new var2 = g_iClientInfo;
    var2[0] = var2[0] | 4;
    if (SQL_CheckConfig("vip"))
    {
        SQL_TConnect(OnDBConnect, "vip", any:1);
    }
    else
    {
        decl String:sError[256];
        sError[0] = MissingTAG:0;
        g_hDatabase = SQLite_UseDatabase("vip", sError, 256);
        OnDBConnect(g_hDatabase, g_hDatabase, sError, any:0);
    }
    return 0;
}

public OnDBConnect(Handle:hOwner, Handle:hQuery, String:sError[], any:data)
{
    new var1;
    if (hQuery && sError[0])
    {
        SetFailState("OnDBConnect %s", sError);
        new var2 = g_iClientInfo;
        var2[0] = var2[0] & -5;
        return 0;
    }

Sorry, MarkDown formatting looks like a shit.

CrazyHackGUT commented 6 years ago

You decompiled? Seriously?

https://github.com/R1KO/VIP-Core/blob/11bb1fec61e0d9ab2ab388c5011d1de7e5000d35/addons/sourcemod/scripting/vip/Database.sp#L6-L70