Eric Wong <[email protected]> wrote: > I assume you're using regular "unicorn" to run your Sinatra apps and not > "unicorn_rails". I made some largish cleanups to both for the 0.97.0 > release and and perhaps some bugs slipped into the "_rails" variant.
<snip> > Jamie Wilkinson <[email protected]> wrote: > > Are the goofy worker processes in the process tree a real problem, or > > just a red herring? > > Not sure if it's a problem, but with Bundler I assume Rack itself is a > bundled dependency, but you're starting unicorn_rails out of > /usr/bin/unicorn_rails which indicates Unicorn is not bundled (and won't > use the bundled Rack). Can you ensure your unbundled Rack is the same > version as the bundled one to be on the safe side? > > I've yet to try bundler 0.9 (and have barely used earlier), but you can > also try bundling Unicorn and using the bundled bin/unicorn(_rails) > launchers instead to ensure a consistent environment. > > Unicorn currently ends up (auto)loading "rack/utils" before the > application is loaded, maybe it could (auto)load it after the app is > loaded for preload_app users. Do the following two patches help? I've also pushed out a few cleanups to unicorn.git and also put up a prerelease gem at: http://unicorn.bogomips.org/files/gems/unicorn-0.97.0.7.g22e3.gem Shortlog of changes since 0.97.0: Eric Wong (7): tests: fix to run under Ruby 1.9.2dev KNOWN_ISSUES: document Array#shuffle / Array#sample issue under 1.9 unicorn_rails: use TOPLEVEL_BINDING for eval unicorn_rails: respect user's encoding in config.ru in 1.9 unicorn_rails: rename variable for consistency bin/*: remove unnecessary listeners variable unicorn: load constants after app has loaded >From e1a72d58add4260feb6da56d9d588270173da74f Mon Sep 17 00:00:00 2001 From: Eric Wong <[email protected]> Date: Thu, 8 Apr 2010 17:10:46 -0700 Subject: [PATCH] unicorn_rails: use TOPLEVEL_BINDING for eval This is to ensure there are no namespace inconsistencies --- bin/unicorn_rails | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/bin/unicorn_rails b/bin/unicorn_rails index 37ee027..de2361e 100755 --- a/bin/unicorn_rails +++ b/bin/unicorn_rails @@ -148,7 +148,7 @@ def rails_builder(config, daemonize) when /\.ru$/ raw = File.open(config, "rb") { |fp| fp.sysread(fp.stat.size) } raw.sub!(/^__END__\n.*/, '') - eval("Rack::Builder.new {(#{raw}\n)}.to_app", nil, config) + eval("Rack::Builder.new {(#{raw}\n)}.to_app", TOPLEVEL_BINDING, config) else require config Object.const_get(File.basename(config, '.rb').capitalize) -- >From 22e3ed4de0e89b97dac91c95c796eb8a7f93e5de Mon Sep 17 00:00:00 2001 From: Eric Wong <[email protected]> Date: Thu, 8 Apr 2010 18:05:43 -0700 Subject: [PATCH] unicorn: load constants after app has loaded This will help ensure we use the same version of Rack the application uses and avoid loading conflicting/incompatible versions. --- lib/unicorn.rb | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/unicorn.rb b/lib/unicorn.rb index b63abeb..75ce09d 100644 --- a/lib/unicorn.rb +++ b/lib/unicorn.rb @@ -800,15 +800,15 @@ module Unicorn def build_app! if app.respond_to?(:arity) && app.arity == 0 - # exploit COW in case of preload_app. Also avoids race - # conditions in Rainbows! since load/require are not thread-safe - Unicorn.constants.each { |x| Unicorn.const_get(x) } - if defined?(Gem) && Gem.respond_to?(:refresh) logger.info "Refreshing Gem list" Gem.refresh end self.app = app.call + + # exploit COW in case of preload_app. Also avoids race + # conditions in Rainbows! since load/require are not thread-safe + Unicorn.constants.each { |x| Unicorn.const_get(x) } end end -- Eric Wong _______________________________________________ Unicorn mailing list - [email protected] http://rubyforge.org/mailman/listinfo/mongrel-unicorn Do not quote signatures (like this one) or top post when replying
