diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2014-12-23 08:37:33 -0700 |
---|---|---|
committer | Sean Griffin <sean@seantheprogrammer.com> | 2014-12-23 08:37:33 -0700 |
commit | c81a74c9727327808aa0b5f31e2b39f220c657f5 (patch) | |
tree | 6e316508e370256409cd34f8923d594d5cf900a7 /activerecord/lib/active_record/connection_adapters | |
parent | 21289bed3bec1407373007296add13590f8855f6 (diff) | |
parent | 5e024070ab3766fada222053d1e0f1116aeb50a6 (diff) | |
download | rails-c81a74c9727327808aa0b5f31e2b39f220c657f5.tar.gz rails-c81a74c9727327808aa0b5f31e2b39f220c657f5.tar.bz2 rails-c81a74c9727327808aa0b5f31e2b39f220c657f5.zip |
Merge pull request #18167 from al2o3cr/checkin_connection_leak
Fix connection leak when a thread checks in additional connections.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb | 10 |
1 files changed, 6 insertions, 4 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 0fa00d03a3..3968b90341 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -363,7 +363,7 @@ module ActiveRecord conn.expire end - release owner + release conn, owner @available.add conn end @@ -376,7 +376,7 @@ module ActiveRecord @connections.delete conn @available.delete conn - release conn.owner + release conn, conn.owner @available.add checkout_new_connection if @available.any_waiting? end @@ -424,10 +424,12 @@ module ActiveRecord end end - def release(owner) + def release(conn, owner) thread_id = owner.object_id - @reserved_connections.delete thread_id + if @reserved_connections[thread_id] == conn + @reserved_connections.delete thread_id + end end def new_connection |