]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Assert reset agent always set correctly and is active
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 13 May 2020 16:42:08 +0000 (12:42 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 13 May 2020 20:05:45 +0000 (16:05 -0400)
commit332d30d03c6cae3ac12fc0b6a5aa1b319a62fec2
treec80d737ef2f64eab6d39aa4779cce4af1ff1f5b6
parent2d80305792e26968c34a215598f7676dd1e93ec2
Assert reset agent always set correctly and is active

Fixed fairly critical issue where the DBAPI connection could be returned to
the connection pool while still in an un-rolled-back state. The reset agent
responsible for rolling back the connection could be corrupted in the case
that the transaction was "closed" without being rolled back or committed,
which can occur in some scenarios when using ORM sessions and emitting
.close() in a certain pattern involving savepoints.   The fix ensures that
the reset agent is always active.

Note for 1.3 the cherry-pick modifies the approach from master as
transaction handling has diverged.

Fixes: #5326
Change-Id: If056870ea70a2d9a1749768988d5e023f3061b31
(cherry picked from commit 4d161ac9c28986e1e022dfb93785767f28d6bfc8)
doc/build/changelog/unreleased_13/5326.rst [new file with mode: 0644]
lib/sqlalchemy/engine/base.py
lib/sqlalchemy/pool/base.py
test/engine/test_pool.py
test/engine/test_transaction.py
test/orm/test_transaction.py