I have deployed a Rails app on Heroku since 2 years without trouble Todays the app crash.
Rails log are:
/app/vendor/bundle/ruby/2.3.0/gems/pg-0.21.0/lib/pg.rb:56:in `initialize': FATAL: sorry, too many clients already (PG::ConnectionBad)
FATAL: sorry, too many clients already
My rails app is v5.2.0
I use Heroku with 2 dyno The database is a postgres with "Hobby Dev". I try:
To upgrade the database but I got the same error
heroku addons:create heroku-postgresql:standard-0 --follow DATABASE_URL --app locabri Creating heroku-postgresql:standard-0 on ⬢ xxxx... ! ▸ An error was encountered when contacting the add-on partner to create heroku-postgresql:standard-0: The database you are attempting to follow was not found.
to change DB_POOL in env variable
heroku pg:info
=== DATABASE_URL Plan: Hobby-dev Status: Available Connections: 0/20 PG Version: 10.6 Created: 2017-05-29 07:40 UTC Data Size: 138.8 MB Tables: 12 Rows: 5748/10000 (In compliance) Fork/Follow: Unsupported Rollback: Unsupported Continuous Protection: Off Region: Europe Add-on: postgresql-regular-79163
But nothing work. I can't do anything on the database because I can't connect on it and and don't know how to restart it. Thanks for your help or question
EDIT
- heroku pg:killall doesnt work
SOLUTION
I finally find the solution by changing the available dyno !
heroku ps:scale web=0
heroku ps:scale web=2
heroku restart
Now I can check the "connexion leak"