]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Ensure weakref finalize_fairy operates upon the current connection
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 8 Feb 2018 19:52:29 +0000 (14:52 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 8 Feb 2018 22:40:09 +0000 (17:40 -0500)
commit1e6b9b04de9fffdca9a76e9b9a3b05c98d4a84b2
treea4850392ac47c5fcfd3ef5ddb64e24dcd3014099
parentcf64e2574cfdd29aaf9b60bbd1b18e026e18049a
Ensure weakref finalize_fairy operates upon the current connection

Fixed a fairly serious connection pool bug where a connection that is
acquired after being refreshed as a result of a user-defined
:class:`.DisconnectionError` or due to the 1.2-released "pre_ping" feature
would not be correctly reset if the connection were returned to the pool by
weakref cleanup (e.g. the front-facing object is garbage collected); the
weakref would still refer to the previously invalidated DBAPI connection
which would have the reset operation erroneously called upon it instead.
This would lead to stack traces in the logs and a connection being checked
into the pool without being reset, which can cause locking issues.

Change-Id: Iabd9f3a63a1d0207d0de0054a6ced3560818cf9c
Fixes: #4184
doc/build/changelog/unreleased_11/4184.rst [new file with mode: 0644]
lib/sqlalchemy/pool.py
test/engine/test_pool.py
test/engine/test_reconnect.py