Rails 4 custom 404 causes postgresql connection failure on Heroku

I have a Rails 4 application deployed on Heroku in production with a custom domain. I also have an intermediate version. The application uses a comfortable Mexican sofa.

The following problem occurs: the application reaches a state in which all requests return a 500 error. Logs show:

[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)

Subsequent attempts to connect the result in connections with error 500 and db remain at 0.

This problem occurred after creating custom error pages using this guide: http://wearestac.com/blog/dynamic-error-pages-in-rails .

404, , 5 6 .

Edit:

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

, .

+3
1

:

class ErrorsController < ApplicationController
  def not_found
    respond_to do |format|
      format.any(:htm, :html, :xls, :xlsx) { render :status => 404, :layout => "error_frame", :formats => [:html] }
      format.all { render nothing: true, status: 404 }
    end
  end

  def unacceptable
    respond_to do |format|
      format.html { render :status => 422, :layout => "error_frame" }
      format.all { render nothing: true, status: 422 }
    end
  end

  def internal_error
    respond_to do |format|
      format.html { render :layout => false, :status => 500 }
      format.all { render nothing: true, status: 500}
    end
  end
end
+1

All Articles