You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If innerConnection.EnlistTransaction fails within FbConnection.Open the innerConnection is not properly disposed of or returned to the
connection pool. I encountered this problem when I attempted to Open a connection fater an ambient transaction timed out. As a result,
the embedded database fiel was left locked after all associated connections were closed. This problem was soleved by wrapping
the EnlistTransaction call in a catch block that cleans up the innerConnection prior to rethrowing the exception.
try
{
if (this.options.Enlist && (System.Transactions.Transaction.Current != null))
{
this.innerConnection.EnlistTransaction(System.Transactions.Transaction.Current,
this.connectionString);
}
}
catch
{
// if enlistment fails clean up innerConnection
this.innerConnection.DisposeTransaction();
if \(this\.innerConnection\.Pooled\)
\{
// Send connection to the Pool
FbPoolManager\.Instance\.GetPool\(this\.connectionString\)\.CheckIn\(this\.innerConnection\);
\}
else
\{
this\.innerConnection\.Dispose\(\);
this\.innerConnection = null;
\}
throw;
\}
Submitted by: Barry Schwarz (bschw)
Assigned to: @carlosga
If innerConnection.EnlistTransaction fails within FbConnection.Open the innerConnection is not properly disposed of or returned to the
connection pool. I encountered this problem when I attempted to Open a connection fater an ambient transaction timed out. As a result,
the embedded database fiel was left locked after all associated connections were closed. This problem was soleved by wrapping
the EnlistTransaction call in a catch block that cleans up the innerConnection prior to rethrowing the exception.
try
{
if (this.options.Enlist && (System.Transactions.Transaction.Current != null))
{
this.innerConnection.EnlistTransaction(System.Transactions.Transaction.Current,
this.connectionString);
}
}
catch
{
// if enlistment fails clean up innerConnection
this.innerConnection.DisposeTransaction();
Commits: ed4e096 b2fedd5
The text was updated successfully, but these errors were encountered: