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
A failed join leaves zope.sqlalchemy in an inconsistent state #2
Comments
This definitely sounds like a bug to me. The Could you write a test which demonstrates the failure? For example |
I have added a test demonstrating this behavior: |
Thanks. I committed your test and a fix: |
Any idea when the next release will be? |
On Fri, Aug 30, 2013 at 01:39:08AM -0700, Chris Withers wrote:
Nope. Brian Sutherland |
When a join is attempted while the transaction is in COMMITFAILED zope.sqlalchemy is left in an inconsistent state. See zopefoundation#2
If the join() errors, _SESSION_STATE does not get wedged. fixes zopefoundation#2
I am not entirely sure if this is a bug, but the current behavior could at least be considered suboptimal:
When the
ZopeTransactionExtension
triggers ajoin
, while the state of the zope transaction isCOMMITFAILED
aTransactionFailedError
will be raised and the_SESSION_STATE
entry of the sqlalchemy session will be left behind.If the sqlalchemy session is reused in the future (ie because it is threadscoped) it won't be joined to the zope transaction at all, since it already has a corresponding entry in
_SESSION_STATE
. This causes the sqlalchemy transaction to remain open, which can lead to a database transaction being "wedged" until it is closed due to a database timeout or a restart of the zope instance.I am not sure if a join should even be attempted if the transaction is in
COMMITFAILED
. Doing operations on the sqlalchemy session while the zope transaction is in this state could probably be considerer a bug on the user's side. But I believe this should be addressed in some way.The text was updated successfully, but these errors were encountered: