System.Data.SQLite

Login
This project makes use of Eagle, provided by Mistachkin Systems.
Eagle: Secure Software Automation
Overview

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

  1. icomment:
    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 1.0.109.2 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. login: "anonymous"
  3. mimetype: "text/x-fossil-plain"