aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
diff options
context:
space:
mode:
authorChris Williams <cswilliams@users.noreply.github.com>2017-07-13 17:08:39 -0700
committerChris Williams <cswilliams@users.noreply.github.com>2017-07-13 17:08:39 -0700
commit325b3cd6499db1164205198b6e4af90e3d2af865 (patch)
tree5dfc01d747926023f2915bd872d6f65f38cb6ee8 /activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
parent472f39f781e5ebf5dcb19bb432572ba68dfcceca (diff)
downloadrails-325b3cd6499db1164205198b6e4af90e3d2af865.tar.gz
rails-325b3cd6499db1164205198b6e4af90e3d2af865.tar.bz2
rails-325b3cd6499db1164205198b6e4af90e3d2af865.zip
Catch postgres connection errors when trying to dealloc the statement pool
connection_active? will sometimes return true when the connection is actually dead/disconnected (see #3392 for a discussion of why this is). When this happens, a query is run on the dead connection which causes various postgres connection errors to be raised. This fix catches any such errors and ignores them. Closes #29760
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index 8baef19030..66c61b5f4a 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -184,6 +184,7 @@ module ActiveRecord
def dealloc(key)
@connection.query "DEALLOCATE #{key}" if connection_active?
+ rescue PG::Error
end
def connection_active?