Getting PG::ConnectionBad: PQconsumeInput() server closed the connection unexpectedly in a Rails Sidekiq job


I migrated a Rails app from Heroku, and in Sidekiq after a long job that takes more than 1 hour to complete I’m getting this error when the job tries to access the Postgres DB:

I’m not seeing anything suspicious in the logs and metrics.

Anyone else had a similar problem?

I had a similar problem, and it went away when I specified the Sidekiq worker in the [process] block. It might be coincidental but I thought it was worth sharing.

@mcart hey, have you found the solution?