diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-07-17 15:03:20 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-07-17 15:03:20 -0400 |
commit | 83563e0acc9fd3e1aace5300c2f2b6d75ed5303c (patch) | |
tree | f33bcfbe54f1bda2c8aca3b69955ccd74d22009e | |
parent | 3971a6f94dbb724e23cb5e220ee8dc3e124105ae (diff) | |
download | oslo-db-83563e0acc9fd3e1aace5300c2f2b6d75ed5303c.tar.gz |
Log an exception when reconnect-to-disconnected occurs
The scenario where an existing database connection that's
present in the pool is found to be not connected to the
database should normally not be occurring; the idle_timeout
setting (aka pool_recycle) should be less than the effective "idle timeout"
set up on the server and/or HAProxy such that a stale
connection in the pool should already have been recycled.
As a system with a mis-configured idle_timeout can experience
latency due to this error hook, it should be reported that
this is an avoidable situation which is occurring. Right
now there's no easy way to see if a performance test is
spending lots of time hitting this condition or not.
Change-Id: I3e9613cbb982c727762247201c5c4972e21da725
-rw-r--r-- | oslo_db/sqlalchemy/engines.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/oslo_db/sqlalchemy/engines.py b/oslo_db/sqlalchemy/engines.py index a54cb23..8cbd36c 100644 --- a/oslo_db/sqlalchemy/engines.py +++ b/oslo_db/sqlalchemy/engines.py @@ -77,6 +77,8 @@ def _connect_ping_listener(connection, branch): # "invalid", but the pool should be ready to return # new connections assuming they are good now. # run the select again to re-validate the Connection. + LOG.exception( + 'Database connection was found disconnected; reconnecting') connection.scalar(select([1])) finally: connection.should_close_with_result = save_should_close_with_result |