diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-03-04 12:12:55 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-03-04 12:12:55 +0000 |
commit | 5da277b182604cef0ea68f79462568cb52af6706 (patch) | |
tree | 9ca2664c977b85974de3f1a466bd5b9f5c06e19d /railties/dispatches | |
parent | d43392a50b4f7023b13747a67c4a6aa85e4036c4 (diff) | |
download | rails-5da277b182604cef0ea68f79462568cb52af6706.tar.gz rails-5da277b182604cef0ea68f79462568cb52af6706.tar.bz2 rails-5da277b182604cef0ea68f79462568cb52af6706.zip |
Added begin/rescue around the FCGI dispatcher so no uncaught exceptions 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
Diffstat (limited to 'railties/dispatches')
-rwxr-xr-x | railties/dispatches/dispatch.fcgi | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/railties/dispatches/dispatch.fcgi b/railties/dispatches/dispatch.fcgi index 0f1b9b3a4b..1c88d902df 100755 --- a/railties/dispatches/dispatch.fcgi +++ b/railties/dispatches/dispatch.fcgi @@ -4,4 +4,17 @@ require File.dirname(__FILE__) + "/../config/environment" require 'dispatcher' require 'fcgi' -FCGI.each_cgi { |cgi| Dispatcher.dispatch(cgi) }
\ No newline at end of file +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
\ No newline at end of file |