Skip to content

Are we required to release on pooled connections with a rollback? #925

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

Closed
jadrake75 opened this issue Oct 14, 2014 · 1 comment
Closed
Labels

Comments

@jadrake75
Copy link

It is not clear to me if we have to call connection.release() on a pooled connection upon rolling back during a transaction. ie...

connection.rollback(function() { // pooled connection
   // do we release connection??? Or should it be done before calling rollback?
});

This comment seems to elude that the connection pool would do this, however I didn't see anything in the code that backs this up.
#586 (comment)

I am NOT doing this today, but I noticed that doing an operation that was a few levels deep in the transaction and rolling back, that subsequent queries were getting the ENQUEUE error and I was wondering if this was caused by not releasing the connection back to the pool on a rollback.

@dougwilson
Copy link
Member

Yes, you must always call connection.release() on a connection; I mean, you can always just start another transaction on the same connection after calling connection.rollback(), so it doesn't make sense for that to release the connection.

The only case where you don't call connection.release() is when pool.getConnection() did not give you a connection in the first place. I hope that clears it up for you.

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

No branches or pull requests

2 participants