diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-07-22 17:59:34 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-07-22 18:03:36 -0400 |
| commit | 4096ad0f0980f6940be57aaee85791df8f975cd7 (patch) | |
| tree | 3cbba9826c3d8be0dfa4da2fa0241e5847d83d42 /lib/sqlalchemy/pool.py | |
| parent | a6e83b204ffc13817fd0ef5bd7483ec811704992 (diff) | |
| download | sqlalchemy-4096ad0f0980f6940be57aaee85791df8f975cd7.tar.gz | |
- Fixed critical issue whereby the pool "checkout" event handler
may be called against a stale connection without the "connect"
event handler having been called, in the case where the pool
attempted to reconnect after being invalidated and failed; the stale
connection would remain present and would be used on a subsequent
attempt. This issue has a greater impact in the 1.0 series subsequent
to 1.0.2, as it also delivers a blanked-out ``.info`` dictionary to
the event handler; prior to 1.0.2 the ``.info`` dictionary is still
the previous one.
fixes #3497
Diffstat (limited to 'lib/sqlalchemy/pool.py')
| -rw-r--r-- | lib/sqlalchemy/pool.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/sqlalchemy/pool.py b/lib/sqlalchemy/pool.py index b38aefb3d..4dd954fc4 100644 --- a/lib/sqlalchemy/pool.py +++ b/lib/sqlalchemy/pool.py @@ -587,7 +587,12 @@ class _ConnectionRecord(object): if recycle: self.__close() self.info.clear() + + # ensure that if self.__connect() fails, + # we are not referring to the previous stale connection here + self.connection = None self.connection = self.__connect() + if self.__pool.dispatch.connect: self.__pool.dispatch.connect(self.connection, self) return self.connection |
