Skip to content

Commit

Permalink
For failed connection requests in ConnectionPool in case of PoolBlock…
Browse files Browse the repository at this point in the history
…ingPeriod not enabled, ensure stacktrace of the exception is not swallowed (#1768)
  • Loading branch information
sorensenmatias authored Sep 27, 2022
1 parent 50ec923 commit f62ac3b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ namespace Microsoft.Data.ProviderBase
{
sealed internal partial class DbConnectionPool
{
partial void CheckPoolBlockingPeriod(Exception e)
{
if (!IsBlockingPeriodEnabled())
{
throw e;
}
}

private bool IsBlockingPeriodEnabled()
{
var poolGroupConnectionOptions = _connectionPoolGroup.ConnectionOptions as SqlConnectionString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,12 @@ private DbConnectionInternal CreateObject(DbConnection owningObject, DbConnectio
throw;
}

CheckPoolBlockingPeriod(e);
#if NETCOREAPP
if (!IsBlockingPeriodEnabled())
{
throw;
}
#endif

// Close associated Parser if connection already established.
if (newObj?.IsConnectionAlive() == true)
Expand Down Expand Up @@ -824,9 +829,6 @@ private DbConnectionInternal CreateObject(DbConnection owningObject, DbConnectio
return newObj;
}

//This method is implemented in DbConnectionPool.NetCoreApp
partial void CheckPoolBlockingPeriod(Exception e);

private void DeactivateObject(DbConnectionInternal obj)
{
SqlClientEventSource.Log.TryPoolerTraceEvent("<prov.DbConnectionPool.DeactivateObject|RES|CPOOL> {0}, Connection {1}, Deactivating.", ObjectID, obj.ObjectID);
Expand Down

0 comments on commit f62ac3b

Please sign in to comment.