Skip to content

Commit

Permalink
Added begin/rescue around the FCGI dispatcher so no uncaught exceptio…
Browse files Browse the repository at this point in the history
…ns can bubble up to kill the process (logs to log/fastcgi.crash.log)

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@831 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Mar 4, 2005
1 parent d43392a commit 5da277b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions railties/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*

* Added begin/rescue around the FCGI dispatcher so no uncaught exceptions can bubble up to kill the process (logs to log/fastcgi.crash.log)

* Fixed that association#count would produce invalid sql when called sequentialy #659 [kanis@comcard.de]

* Fixed test/mocks/testing to the correct test/mocks/test #740
Expand Down
15 changes: 14 additions & 1 deletion railties/dispatches/dispatch.fcgi
Expand Up @@ -4,4 +4,17 @@ require File.dirname(__FILE__) + "/../config/environment"
require 'dispatcher'
require 'fcgi'

FCGI.each_cgi { |cgi| Dispatcher.dispatch(cgi) }
log_file_path = "#{RAILS_ROOT}/log/fastcgi.crash.log"

FCGI.each_cgi do |cgi|
begin
Dispatcher.dispatch(cgi)
rescue Object => e
error_message = "[#{Time.now}] Dispatcher failed to catch: #{e} (#{e.class})\n #{e.backtrace.join("\n ")}\n"
begin
Logger.new(log_file_path).fatal(error_message)
rescue Object => log_error
STDERR << "Couldn't write to #{log_file_path} (#{log_error} [#{log_error.class}])\n" << error_message
end
end
end

0 comments on commit 5da277b

Please sign in to comment.