diff options
author | Matthew Draper <matthew@trebex.net> | 2016-07-06 08:37:26 +0930 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2016-07-06 08:59:56 +0930 |
commit | f4159506d68d7d7781e1534bebbf83c0c3423562 (patch) | |
tree | c32d24d65bea5321f3e44f50659b5eb314479cd5 /activerecord/lib/active_record | |
parent | 76ce08a493fbd9f8c38d719f4c329bc2153204fc (diff) | |
download | rails-f4159506d68d7d7781e1534bebbf83c0c3423562.tar.gz rails-f4159506d68d7d7781e1534bebbf83c0c3423562.tar.bz2 rails-f4159506d68d7d7781e1534bebbf83c0c3423562.zip |
Re-check that the connection is still stale before we reap it
A concurrent thread may have also detected it to be stale, and already
released (or even reassigned) it by now.
Fixes #25585
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb index c341773be1..51bbc02b0c 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -561,6 +561,8 @@ module ActiveRecord stale_connections.each do |conn| synchronize do + next unless conn.in_use? && !conn.owner.alive? + if conn.active? conn.reset! checkin conn |