Bug Reproduction: ActiveRecord::StatementInvalid: PG::DuplicatePstatement: ERROR: prepared statement "XXX" already exists
so basically here in postgres_adapter.rb I am manually raising a raise Rack::Timeout::RequestTimeoutError and if that exception is captured, the code continues to execute, then the next time the code wants to access the DB the PG::DuplicatePstatement: ERROR will occurr.
the way to solve this is to add a begin/ensure block to the affected area to make sure prepared statements are generated correctly
NOTE: i raise the error when the counter gets to 130 since this method is excecuted many times