Ticket Change Details
Not logged in

Artifact ID: 794ce057e7990ecd5f6c25963f8326bf77d5e4ea
Ticket: 69cfdf79fa11f506602146b0fd192c9a546ad167
Pooling not working after upgrading to 1.0.109.x
User & Date: anonymous 2018-11-12 11:01:09

  1. Change icomment to:

    I'm using the default ISQLiteConnectionPool implementation, but reproducing this issue with a barebones test code I've pinpointed the root cause: setting SQLiteConnectionStringBuilder.FailIfMissing to true causes SQLiteConnection.PoolCount not to return its expected value.

    Here's my code, which using System.Data.SQLite.Core shows a final SQLiteConnection.PoolCount of 0 instead of 63 when using System.Data.SQLite.Core 1.0.108:

    using System; using System.Data.SQLite; using System.Linq;

    namespace Test109 { class Program { private const int MaxPoolSize = 64; private const int Preserve = 1; private static SQLiteConnectionStringBuilder _sqLiteConnectionStringBuilder;

    static void Main(string[] args) { Console.WriteLine($"Using SQLite {SQLiteConnection.SQLiteVersion}");
    _sqLiteConnectionStringBuilder = new SQLiteConnectionStringBuilder($"Max Pool Size={MaxPoolSize}") { DataSource = ":memory:", FailIfMissing = true, // This setting causes SQLiteConnection.PoolCount not to return its expected value. Pooling = true, ToFullPath = false, };
    var connections = Enumerable.Range(1, MaxPoolSize).Select(_ => OpenSqLiteConnection()).ToArray(); foreach (var connection in connections.Skip(Preserve)) { CloseSqLiteConnection(connection); }
    CheckSqLiteConnection(connections[0]); }
    private static SQLiteConnection OpenSqLiteConnection() { var connection = new SQLiteConnection(_sqLiteConnectionStringBuilder.ToString()); connection.Open();
    CheckSqLiteConnection(connection); return connection; }
    private static void CloseSqLiteConnection(SQLiteConnection connection) { connection.Close(); CheckSqLiteConnection(connection); }
    private static void CheckSqLiteConnection(SQLiteConnection connection) { Console.WriteLine($"Connection {connection.State}: {connection.PoolCount} in pool"); } } }
  2. Change login to "anonymous"
  3. Change mimetype to "text/x-fossil-plain"