Search code examples
ruby-on-railsrubypgbouncer

PG::ConnectionBad with rails and pgbouncer


I have rails and pgBouncer, and I have reconnect: true in the database.yml but I keep getting this in the console:

ActiveRecord::StatementInvalid: PG::ConnectionBad: PQconsumeInput() server closed the connection unexpectedly

The same error happens in sidekiq but not in web, shouldn't rails reconnect after having this error?


Solution

  • It was a timeout configured in the server (that I wasn't aware of). So it doesn't have anything to do with rails/pgbouncer, in fact reconnect flag in the database.yml isn't used anymore in rails.