Skip to content

Calling SQL_LockDatabase twice is crashing server #1936

@Bara

Description

@Bara

Environment

  • SourceMod version: 1.11.0.6916
  • Metamod: version: 1.11.0-dev+1148

Description

I randomly found the issue and is reproducible with the following code, sqlite and mysql doesn't matter.

Problematic Code (or Steps to Reproduce)

public void OnPluginStart()
{
  char sError[512];
  Database db = SQL_Connect("clientprefs", true, sError, sizeof(sError));

  if (db == null)
  {
      SetFailState("Error: %s", sError);
      return;
  }

  SQL_LockDatabase(db);
  SQL_LockDatabase(db);
  SQL_UnlockDatabase(db);
}

Last message in console was the following:

sm plugins load crashtest
**** WARNING: Watchdog timer exceeded, aborting!

I'm not really familiar how SQL_LockDatabase works, but this should be checked to avoid a crash like this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions