On Thu, Sep 18, 2008 at 07:08:56AM +0200, Dieter Maurer wrote:
Brian Sutherland wrote at 2008-9-17 12:33 +0200:
On Tue, Sep 16, 2008 at 02:01:07PM +0100, Laurence Rowe wrote:
Brian Sutherland wrote:
Hi,
I've recently seen a situation where zope.sqlalchemy locked up the transaction machinery. I'm not sure exactly what happened, but have attached a failing test for at least one bug which may have caused it. Hopefully it's self explanatory;)
If someone could help me solve this, that would be great!
Could you try this with latest trunk. I checked in a fix the other day that may help.
I just checked in a fix, please feel free to comment on/revert it if it's not up to standard:)
It looks not yet right to clear the state in "tpc_vote" when a two phase commit is used (which is now supported by "SQLAlchemy").
It looks to me that in a two phase commit, the tpc_vote which is called is: def tpc_vote(self, trans): if self.tx is not None: # there may have been no work to do self.tx.prepare() self.state = 'voted' is that what you mean by clearing state?
In addition, there may be a problem in case "session.close()" raises an exception. Then, "_finish" would not be called.
I modified my patch, moving session.close() into _finish and actually calling close() after the state is cleared. That way, the errors can propagate, but the transaction will not get wedged. -- Brian Sutherland