ODBC Firebird connections limit

I have simple code that creates connection to Firebird (any version, from 2.5 to 5.0).

C#, x64, FbConnection, 1000 connections, all working fine:

List<FbConnection> fbList = new List<FbConnection>();
for (int i = 1; i <= 1000; i++)
{
    try
    {

        var connection = new FbConnection("User=SYSDBA;Password=masterkey;Database=localhost/3053:c:\\rollcontrol\\rollcontrol;Pooling=false; MinPoolSize=0;MaxPoolSize=2000");
        connection.Open();

        fbList.Add(connection);
        Console.WriteLine(i.ToString());

    }
    catch (Exception e)
    {
        Console.WriteLine(DateTime.Now.ToString() + ": " + e.ToString());
    }
}

C#, x64, OdbcConnection, 1000 connections, process stopping on 180 connections (no error, the process just hangs):

List<OdbcConnection> odbcList = new List<OdbcConnection>();
for (int i = 1; i <= 1000; i++)
{
    try {

        OdbcConnection DbConnection = new OdbcConnection("DSN=rollcontrol");
        DbConnection.Open();

        odbcList.Add(DbConnection);
        Console.WriteLine(i.ToString());

    } catch (Exception e) { 
        Console.WriteLine(DateTime.Now.ToString() + ": " + e.ToString());
    }
}

ODBC has a limit on the number of connections? Maybe, it is possible to increase the limit number of connections?

UPDATE

Issue fixed in Firebird ODBC Driver 3.0.16 and ODBC 2.0.6

Upvotes: 0

Views: 72

Answers (1)

Mark Rotteveel
Mark Rotteveel

Reputation: 109155

As hashed out in the issue you reported, this is a bug in the Firebird ODBC driver that only happens with connections created by administrators (SYSDBA and users specifying the RDB$ADMIN role).

The driver tries to find out the current real user of the connection by requesting isc_info_user_names, which for administrators reports the usernames for all connections to the current database in the current server process, and not just the username for the current connection, which with a lot of connections causes a truncation, which the driver doesn't (or since your pull request, didn't) handle correctly.

As a workaround, you can do one of the following:

  1. Use a non-administrator user

  2. Use Firebird ClassicServer (specify ServerMode = Classic in firebird.conf).

    In ClassicServer mode, each connection has its own process, so the isc_info_user_names information request only reports one user, even for administrators.

Upvotes: 3

Related Questions