On Jan 26, 2006, at 10:55 AM, James Adam wrote:
At a slight tangent, isolating application sessions won't fully solve this problem; you can change the name of a Model object and see this 'white screen of death' within the same application. Something needs to be wrapped around the session loading to let Rails gracefully handle loading a malignant session and at least give the user *some* feedback (logs, 500 status, anything really).
The root of the issue here is that CGI::Session doesn't raise an exception when this sort of behavior occurs. It's awful, I know, but it's the sad truth: there's no way to know in advance if
request = ActionController::CgiRequest.new(cgi, session_options)
will totally fail or not, and there's no exception raised. It's even in the docs that "things will break nastily" [1] in just this sort of situation. If I am wrong here (and I'd love to be) then please let me know.
That said, I think creating the RAILS_ROOT/tmp directory on-demand is a good idea - as Jamis points out, there are already files (like fastcgi sockets) which are floating around and need an appropriate home - a tmp directory seems to make sense here. It wouldn't be hard to provide a rake task to clean it up/remove it either:
The only question that remains for the on-demand issue is what to do about lighttpd's sockets--as far as I know, the folder that the sockets go in has to exist before lighttpd will even try to communicate with fcgi. I could be wrong here, too. Perhaps we can create tmp/ when "ruby script/server" is invoked? In any case, I think the railties default behavior should be to generate an empty tmp/ folder for completeness. desc 'Clear all sessions and temporary files for this application' task :clear_tmp => :environment do # presuming RAILS_TMP is either defined by the user, or set by default: # RAILS_TMP = File.join(RAILS_ROOT, 'tmp') unless Object.const_defined?(:RAILS_TMP) FileUtils.rm_r(RAILS_TMP) end
desc 'Clean application' task :clean => [:clear_logs, :clear_tmp]
Nice :)
Duane Johnson (canadaduane)
|
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core