PG::DupliacatePstatement: Error: prepared statement already exists

I am getting the following error in production environment

“PG::DupliacatePstatement: Error: prepared statement already exists”

Ruby version is 2.2.4 and
Rails version is 4.1.3

I have the following code in my unicorn.rb file:

before_fork do |server, worker|
Signal.trap 'TERM' do
  puts 'Unicorn master intercepting TERM and sending myself QUIT

instead’
Process.kill ‘QUIT’, Process.pid
end

defined?(ActiveRecord::Base) and
  ActiveRecord::Base.connection.disconnect!
end

after_fork do |server, worker|
  Signal.trap 'TERM' do
    puts 'Unicorn worker intercepting TERM and doing nothing. Wait

for master to send QUIT’
end

defined?(ActiveRecord::Base) and
  ActiveRecord::Base.establish_connection
end

I have added

prepared_statement: false

in database.yml file. In environments/production.rb file, I have

config.cache_classes = false
config.action_controller.perform_caching = false

Can anyone please suggest a solution for this error?

On 31 March 2016 at 17:39, Vivek B. [email protected] wrote:

I am getting the following error in production environment

“PG::DupliacatePstatement: Error: prepared statement already exists”

Show us the lines of code that cause the problem.

Colin