Skip to content
Rex St. John

Get in touch

Fixing "could not obtain a database connection within 5.000 seconds" on Heroku

Being a relative Ruby on Rails + Heroku n00b I was being plagued by an error message which accompanied hard crashes on my RoR server being deployed on...

Originally published on the rexstjohn.com blog

Tags
  • ruby

Originally published at rexstjohn.com on August 23, 2014. Recovered from the Internet Archive.

Being a relative Ruby on Rails + Heroku n00b I was being plagued by an error message which accompanied hard crashes on my RoR server being deployed on Heroku:

"Error during failsafe response: could not obtain a database connection within 5.000 seconds"

This seems to basically just mean that the thread pool got tied up processing stuff and crapped itself. The fix is to use Unicorn or other solution to improve the way Rails allocates resources within Dynos. It took me 3 minutes to install Unicorn using the Heroku instructions and the problem has not occurred again.