# HG changeset patch # User Julien Cristau # Date 1398682454 -7200 # Node ID 4a23058e4d9f12e955c0a00ffbe20dd099be3c44 # Parent f24c30a19898cbf79b1410740b8bee9fad193f3a [server/session] add missing rollback when freeing a db connection When we let go of a cnxset and give it back to the pool, we need to make sure it's not in the middle of a transaction. We got bitten by a migration where the connection used by admin's repo.connect was not rolled back before attempting the migration, causing a deadlock because it had a lock on a table. This could potentially also be an issue for e.g. hooks or looping tasks that didn't explicitly rollback before calling free_cnxset or moving out of a ensure_cnx_set block. diff -r f24c30a19898 -r 4a23058e4d9f server/session.py --- a/server/session.py Thu Apr 24 17:52:20 2014 +0200 +++ b/server/session.py Mon Apr 28 12:54:14 2014 +0200 @@ -593,6 +593,7 @@ if new_cnxset is old_cnxset: return #nothing to do if old_cnxset is not None: + old_cnxset.rollback() self._cnxset = None self.ctx_count -= 1 self._cnxset_tracker.forget(self.connectionid, old_cnxset)