diff options
author | Yoshioka Tsuneo <yoshiokatsuneo@gmail.com> | 2015-01-09 14:33:17 +0900 |
---|---|---|
committer | Yoshioka Tsuneo <yoshiokatsuneo@gmail.com> | 2015-01-09 14:33:17 +0900 |
commit | 205a561e50c89f7b81336a295f97209d741cfa67 (patch) | |
tree | fb4708b57bf777d2dc99e1fa90e8b66114a3b5f3 /railties/lib/rails/backtrace_cleaner.rb | |
parent | a74041d483041345454e766c506dab1b567dec0d (diff) | |
download | rails-205a561e50c89f7b81336a295f97209d741cfa67.tar.gz rails-205a561e50c89f7b81336a295f97209d741cfa67.tar.bz2 rails-205a561e50c89f7b81336a295f97209d741cfa67.zip |
ActiveRecord: release connection on reconnect failure.
When trying to checkout connection from connection pool,
checkout()(and checkout_and_verify) verify whether the connection
is active or not.
And, if the connection is not active, connection adapters try to
reconnect to server. And, if database is down at this moment,
reconnect fails and exception is raised.
(Ex: Mysql2::Error: Can't connect to local MySQL server through socket xxx)
But, ConnectionPool does not catch the exception, but leaks current
disconnected connection to @connection.
So, if database's temporary down happens several times and exceeds
the number of connection pool(5 by default), activerecord will be
no more available, even if database server is already recovered.
This patch fix it by catching exception and releasing connection.
Diffstat (limited to 'railties/lib/rails/backtrace_cleaner.rb')
0 files changed, 0 insertions, 0 deletions