Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enlistment failure leaves innerConnection dangling [DNET101] #113

Closed
firebird-automations opened this issue Jun 27, 2007 · 5 comments
Closed

Comments

@firebird-automations
Copy link

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();

                    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;
                \}

Commits: ed4e096 b2fedd5

@firebird-automations
Copy link
Author

Modified by: @carlosga

Fix Version: 2.1.0 RC 2 [ 10180 ]

@firebird-automations
Copy link
Author

Commented by: @carlosga

I will commit the change later today, thanks very much !

@firebird-automations
Copy link
Author

Modified by: @carlosga

status: Open [ 1 ] => In Progress [ 3 ]

@firebird-automations
Copy link
Author

Commented by: @carlosga

Fixed in devel trunk ( with some minor changes :) ), thanks very much

@firebird-automations
Copy link
Author

Modified by: @carlosga

status: In Progress [ 3 ] => Closed [ 6 ]

resolution: Fixed [ 1 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant