Bug #111990 mysql-connector-net-8.0.33-src
Submitted: 8 Aug 2023 0:58 Modified: 10 Aug 2023 4:56
Reporter: ada jin Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:mysql-connector-net-8.0.33-src OS:Any
Assigned to: CPU Architecture:Any
Tags: mysql-connector-net-8.0.33-src

[8 Aug 2023 0:58] ada jin
Description:
 public static async Task<MySqlPool> GetPoolAsync(MySqlConnectionStringBuilder settings, bool execAsync, CancellationToken cancellationToken)
    {
      string text = GetKey(settings);

      SemaphoreSlim semaphoreSlim = new SemaphoreSlim(1);
      semaphoreSlim.Wait(CancellationToken.None);
      MySqlPool pool;
      Pools.TryGetValue(text, out pool);

      if (pool == null)
      {
        pool = await MySqlPool.CreateMySqlPoolAsync(settings, execAsync, cancellationToken).ConfigureAwait(false);
        Pools.Add(text, pool);
      }
      else
        pool.Settings = settings;

      semaphoreSlim.Release();
      return pool;
    }

How to repeat:
 public static async Task<MySqlPool> GetPoolAsync(MySqlConnectionStringBuilder settings, bool execAsync, CancellationToken cancellationToken)
    {
      string text = GetKey(settings);

      SemaphoreSlim semaphoreSlim = new SemaphoreSlim(1);
      semaphoreSlim.Wait(CancellationToken.None);
      MySqlPool pool;
      Pools.TryGetValue(text, out pool);

      if (pool == null)
      {
        pool = await MySqlPool.CreateMySqlPoolAsync(settings, execAsync, cancellationToken).ConfigureAwait(false);
        Pools.Add(text, pool);
      }
      else
        pool.Settings = settings;

      semaphoreSlim.Release();
      return pool;
    }

Suggested fix:
这个地方加信号量锁不住,是一个局部变量,会引发并发问题
[8 Aug 2023 14:38] Bradley Grainger
Duplicate of bug #110717.

Will be fixed by the patch submitted in bug #111759.
[10 Aug 2023 0:38] ada jin
什么时候修复,几个版本都有这个问题,都不敢升级了
[10 Aug 2023 4:56] MySQL Verification Team
Thank you, Bradley Grainger.
Marking this as duplicate of Bug#110717.