Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed connection leak detection and handling

By Francisco's request
  • Loading branch information...
commit cefdbaf204c74b344ad3be4cce3efe7a5310d2d7 1 parent fccc7b3
@roji roji authored
Showing with 0 additions and 44 deletions.
  1. +0 −22 src/Npgsql/NpgsqlConnection.cs
  2. +0 −22 src/Npgsql/NpgsqlConnectorPool.cs
View
22 src/Npgsql/NpgsqlConnection.cs
@@ -125,9 +125,6 @@ public sealed class NpgsqlConnection : DbConnection, ICloneable
// Used when the connection is closed but an TransactionScope is still active
// (the actual close is postponed until the scope ends)
private bool _postponingClose;
- // Used when the connection is disposed with a leak but an TransactionScope is still active
- // (the actual leak report is postponed until the scope ends)
- private bool _postponingHandleLeak;
// Strong-typed ConnectionString values
private NpgsqlConnectionStringBuilder settings;
@@ -652,8 +649,6 @@ internal void PromotableLocalTransactionEnded()
NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "PromotableLocalTransactionEnded");
if (_postponingClose)
ReallyClose();
- if (_postponingHandleLeak)
- HandleLeak();
}
/// <summary>
@@ -696,28 +691,11 @@ protected override void Dispose(bool disposing)
NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Dispose");
Close();
}
- else
- {
- if (FullState != ConnectionState.Closed)
- {
- if (promotable != null && promotable.InLocalTransaction)
- _postponingHandleLeak = true;
- else
- HandleLeak();
- }
- }
base.Dispose(disposing);
disposed = true;
}
- private void HandleLeak()
- {
- NpgsqlEventLog.LogMsg(resman, "Log_ConnectionLeaking", LogLevel.Debug);
- _postponingHandleLeak = false;
- NpgsqlConnectorPool.ConnectorPoolMgr.FixPoolCountBecauseOfConnectionDisposeFalse(this);
- }
-
/// <summary>
/// Create a new connection based on this one.
/// </summary>
View
22 src/Npgsql/NpgsqlConnectorPool.cs
@@ -497,28 +497,6 @@ private static NpgsqlConnector CreateConnector(NpgsqlConnection Connection)
return new NpgsqlConnector(Connection.ConnectionStringValues.Clone(), Connection.Pooling, false);
}
-
- /// <summary>
- /// This method is only called when NpgsqlConnection.Dispose(false) is called which means a
- /// finalization. This also means, an NpgsqlConnection was leak. We clear pool count so that
- /// client doesn't end running out of connections from pool. When the connection is finalized, its underlying
- /// socket is closed.
- /// </summary>
- public void FixPoolCountBecauseOfConnectionDisposeFalse(NpgsqlConnection Connection)
- {
- ConnectorQueue Queue;
-
- // Prevent multithread access to connection pool count.
- lock (locker)
- {
- // Try to find a queue.
- if (PooledConnectors.TryGetValue(Connection.ConnectionString, out Queue) && Queue != null)
- {
- Queue.Busy.Remove(Connection.Connector);
- }
- }
- }
-
/// <summary>
/// Close the connector.
/// </summary>
Please sign in to comment.
Something went wrong with that request. Please try again.