]> 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 19:56:19 +0000 (14:56 -0500)
commit6c6f865541a7b3bd984cf0fb5cb5f511f7971758
tree8eb21795a18ea6f53708795899585387573ddd83
parent646b803297342dc04501279a860437faae19a7fe
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
(cherry picked from commit ab1f524c355c0bbac68485a60cb99e7a9d0f944a)
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