From 2d38b5d25b1f39f883f112e9750dd8d20ec68d8d Mon Sep 17 00:00:00 2001 From: evanweaver Date: Mon, 12 Nov 2007 20:32:35 +0000 Subject: don't warn about unitted @reason; fix objectspace errors on jruby; make subproject tasks less noisy git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@876 19e92222-5c0b-0410-8929-a290d50e31e9 --- CHANGELOG | 2 ++ Rakefile | 6 +++--- lib/mongrel.rb | 1 + lib/mongrel/debug.rb | 47 ++++++++++++++++++++++++-------------------- lib/mongrel/http_response.rb | 1 + 5 files changed, 33 insertions(+), 24 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 3491aba..f4b7eb6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,6 @@ +v1.1.1. Fix mongrel_rails restart bug; fix bug with Rack status codes. + v1.1. Pure Ruby URIClassifier. More modular architecture. JRuby support. Move C URIClassifier into mongrel_experimental project. v1.0.4. Backport fixes for versioning inconsistency, mongrel_rails bug, and DirHandler bug. diff --git a/Rakefile b/Rakefile index f64628a..398930d 100644 --- a/Rakefile +++ b/Rakefile @@ -120,7 +120,7 @@ def sub_project(project, *targets) targets.each do |target| Dir.chdir "projects/#{project}" do unless RUBY_PLATFORM =~ /mswin/ - sh %{rake --trace #{target.to_s} } + sh("rake #{target.to_s}") # --trace end end end @@ -155,7 +155,7 @@ task :install => [:install_requirements] do sub_project("mongrel_upload_progress", :install) sub_project("mongrel_console", :install) sub_project("mongrel_cluster", :install) - sub_project("mongrel_experimental", :install) + # sub_project("mongrel_experimental", :install) sub_project("mongrel_service", :install) if RUBY_PLATFORM =~ /mswin/ end @@ -167,7 +167,7 @@ task :uninstall => [:clean] do sub_project("mongrel_console", :uninstall) sub_project("gem_plugin", :uninstall) sub_project("fastthread", :uninstall) - sub_project("mongrel_experimental", :uninstall) + # sub_project("mongrel_experimental", :uninstall) sub_project("mongrel_service", :uninstall) if RUBY_PLATFORM =~ /mswin/ end diff --git a/lib/mongrel.rb b/lib/mongrel.rb index e0dcab1..6260ef9 100644 --- a/lib/mongrel.rb +++ b/lib/mongrel.rb @@ -9,6 +9,7 @@ require 'stringio' require 'mongrel/gems' +Mongrel::Gems.require 'gem_plugin' Mongrel::Gems.require 'cgi_multipart_eof_fix' Mongrel::Gems.require 'fastthread' require 'thread' diff --git a/lib/mongrel/debug.rb b/lib/mongrel/debug.rb index 8e21183..2686c1e 100644 --- a/lib/mongrel/debug.rb +++ b/lib/mongrel/debug.rb @@ -122,17 +122,20 @@ module RequestLog begin stats = Hash.new(0) lengths = {} - ObjectSpace.each_object do |o| - begin - if o.respond_to? :length - len = o.length - lengths[o.class] ||= Mongrel::Stats.new(o.class) - lengths[o.class].sample(len) + begin + ObjectSpace.each_object do |o| + begin + if o.respond_to? :length + len = o.length + lengths[o.class] ||= Mongrel::Stats.new(o.class) + lengths[o.class].sample(len) + end + rescue Object end - rescue Object + + stats[o.class] += 1 end - - stats[o.class] += 1 + rescue Object # Ignore since ObjectSpace might not be loaded on JRuby end stats.sort {|(k1,v1),(k2,v2)| v2 <=> v1}.each do |k,v| @@ -171,21 +174,23 @@ module RequestLog def process(request, response) MongrelDbg::trace(:threads, "#{Time.now} REQUEST #{request.params['PATH_INFO']}") - ObjectSpace.each_object do |obj| - begin - if obj.class == Mongrel::HttpServer - worker_list = obj.workers.list - - if worker_list.length > 0 - keys = "-----\n\tKEYS:" - worker_list.each {|t| keys << "\n\t\t-- #{t}: #{t.keys.inspect}" } + begin + ObjectSpace.each_object do |obj| + begin + if obj.class == Mongrel::HttpServer + worker_list = obj.workers.list + + if worker_list.length > 0 + keys = "-----\n\tKEYS:" + worker_list.each {|t| keys << "\n\t\t-- #{t}: #{t.keys.inspect}" } + end + + MongrelDbg::trace(:threads, "#{obj.host}:#{obj.port} -- THREADS: #{worker_list.length} #{keys}") end - - MongrelDbg::trace(:threads, "#{obj.host}:#{obj.port} -- THREADS: #{worker_list.length} #{keys}") + rescue Object # Ignore since obj.class can sometimes take parameters end - rescue Object - # ignore since obj.class can sometimes take parameters end + rescue Object # Ignore since ObjectSpace might not be loaded on JRuby end end end diff --git a/lib/mongrel/http_response.rb b/lib/mongrel/http_response.rb index 1eb7077..32e433e 100644 --- a/lib/mongrel/http_response.rb +++ b/lib/mongrel/http_response.rb @@ -43,6 +43,7 @@ module Mongrel @socket = socket @body = StringIO.new @status = 404 + @reason = nil @header = HeaderOut.new(StringIO.new) @header[Const::DATE] = Time.now.httpdate @body_sent = false -- cgit v1.2.3-24-ge0c7