{"action":"reopened","issue":{"url":"https://api.github.com/repos/npgsql/npgsql/issues/1761","repository_url":"https://api.github.com/repos/npgsql/npgsql","labels_url":"https://api.github.com/repos/npgsql/npgsql/issues/1761/labels{/name}","comments_url":"https://api.github.com/repos/npgsql/npgsql/issues/1761/comments","events_url":"https://api.github.com/repos/npgsql/npgsql/issues/1761/events","html_url":"https://github.com/npgsql/npgsql/issues/1761","id":284505855,"node_id":"MDU6SXNzdWUyODQ1MDU4NTU=","number":1761,"title":"ConnectorPool doesn’t decrement busy counter while connection is opening in aborted ambient transaction","user":{"login":"dsekretov","id":5293579,"node_id":"MDQ6VXNlcjUyOTM1Nzk=","avatar_url":"https://avatars2.githubusercontent.com/u/5293579?v=4","gravatar_id":"","url":"https://api.github.com/users/dsekretov","html_url":"https://github.com/dsekretov","followers_url":"https://api.github.com/users/dsekretov/followers","following_url":"https://api.github.com/users/dsekretov/following{/other_user}","gists_url":"https://api.github.com/users/dsekretov/gists{/gist_id}","starred_url":"https://api.github.com/users/dsekretov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsekretov/subscriptions","organizations_url":"https://api.github.com/users/dsekretov/orgs","repos_url":"https://api.github.com/users/dsekretov/repos","events_url":"https://api.github.com/users/dsekretov/events{/privacy}","received_events_url":"https://api.github.com/users/dsekretov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-12-26T07:04:59Z","updated_at":"2018-08-06T15:04:50Z","closed_at":null,"author_association":"NONE","body":"### Steps to reproduce\r\nI wrote test to reproduce issue.\r\n```\r\n\r\npublic async Task TestExhausted()\r\n{\r\n  var builder = new NpgsqlConnectionStringBuilder(\"paste your connection string here\")\r\n  {\r\n    Enlist = true,\r\n    Pooling = true,\r\n    MinPoolSize = 1,\r\n    MaxPoolSize = 3\r\n  };\r\n  var connectionString = builder.ToString();\r\n\r\n  for (int i = 0; i <= 3; i++) //emulate retry policy\r\n  {\r\n    try\r\n    {\r\n      using (var scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions()  {Timeout = TimeSpan.FromSeconds(3)}, TransactionScopeAsyncFlowOption.Enabled))\r\n      {\r\n        using (var connection = new NpgsqlConnection(connectionString))\r\n        {\r\n          await connection.OpenAsync();\r\n          using (var command = connection.CreateCommand())\r\n          {\r\n            command.CommandText = \"select 1;\";\r\n            await command.ExecuteNonQueryAsync();\r\n          }\r\n        }\r\n\r\n        await Task.Delay(TimeSpan.FromSeconds(5));\r\n\r\n        using (var connection = new NpgsqlConnection(connectionString))\r\n        {\r\n          await connection.OpenAsync();\r\n          using (var command = connection.CreateCommand())\r\n          {\r\n            command.CommandText = \"select 1;\";\r\n            await command.ExecuteNonQueryAsync();\r\n          }\r\n        }\r\n\r\n        scope.Complete();\r\n      }\r\n    }\r\n    catch (TransactionException)\r\n    {\r\n      //do nothing\r\n    }\r\n  }\r\n}\r\n\r\n```\r\n### The issue\r\nThe connection pool has been exhausted at last iteration step.\r\n```\r\nException message: Npgsql.NpgsqlException : The connection pool has been exhausted, either raise MaxPoolSize (currently 3) or Timeout (currently 15 seconds)\r\n```\r\n\r\n### Further technical details\r\n\r\nNpgsql version: 3.2.6\r\nPostgreSQL version: 9.6.6\r\nOperating system: Windows 10\r\n\r\n  "}}
{"actor":{"display_login":"roji"}}