From 325b3cd6499db1164205198b6e4af90e3d2af865 Mon Sep 17 00:00:00 2001 From: Chris Williams Date: Thu, 13 Jul 2017 17:08:39 -0700 Subject: 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 --- activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb') 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? -- cgit v1.2.3