我在 Heroku 上部署了一个带有自定义域的 Rails 4 应用程序。我也有一个临时版本。该应用程序使用舒适的墨西哥沙发。
出现以下问题:应用程序将达到所有请求都返回 500 错误的状态。日志显示:
[jesse@Athens expat]$ heroku logs
ActiveRecord::ConnectionTimeoutError (could not obtain a database connection within 5.000 seconds (waited 5.000 seconds)):
[jesse@Athens expat]$ heroku pg:info
Connections: 5
[jesse@Athens expat]$ heroku pg:ps
pid | state | source | running_for | waiting | query
-----+-------+--------+-------------+---------+-------
(0 rows)
[jesse@Athens expat]$ heroku pg:killall
pg_terminate_backend
----------------------
t
t
t
t
t
(5 rows)
后续尝试连接会导致 500 错误,并且 db 连接仍为 0。
这个问题是在我使用本指南创建自定义错误页面后出现的:http ://wearestac.com/blog/dynamic-error-pages-in-rails 。
我可以通过创建一个使用数据库的 404 页面来强制解决这个问题,然后向服务器发出大约 5 或 6 个请求以获取不存在的页面。
编辑:
我可以在使用静态自定义 404 页面时强制解决问题,方法是发出 5 或 6 个带有 jpeg 扩展名的不存在文件的请求。日志中出现以下内容:
Error during failsafe response: Missing template errors/not_found, application/not_found with {:locale=>[:en], :formats=>[:jpeg], :handlers=>[:erb, :builder, :raw, :ruby, :jbuilder, :coffee, :haml]}. Searched in:
2014-02-17T17:26:14.595469+00:00 app[web.1]: * "/app/app/vi
ews"
2014-02-17T17:26:14.594508+00:00 app[web.1]: Completed 500 Internal Server Error in 7ms
任何隔离此问题的帮助将不胜感激。提前致谢