From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS14383 205.234.109.0/24 X-Spam-Status: No, score=-0.5 required=5.0 tests=AWL,MSGID_FROM_MTA_HEADER, RP_MATCHES_RCVD shortcircuit=no autolearn=unavailable version=3.3.2 Path: news.gmane.org!not-for-mail From: Eric Wong Newsgroups: gmane.comp.lang.ruby.unicorn.general Subject: Re: funky process tree + stillborn masters Date: Thu, 8 Apr 2010 18:20:50 -0700 Message-ID: <20100409012050.GA31641@dcvr.yhbt.net> References: <18DCBEFE-BC6D-41F7-996C-ACACA629ED24@tramchase.com> <20100408235548.GA11184@dcvr.yhbt.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1270776229 1260 80.91.229.12 (9 Apr 2010 01:23:49 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 9 Apr 2010 01:23:49 +0000 (UTC) To: unicorn list Original-X-From: mongrel-unicorn-bounces@rubyforge.org Fri Apr 09 03:23:45 2010 Return-path: Envelope-to: gclrug-mongrel-unicorn@m.gmane.org X-Original-To: mongrel-unicorn@rubyforge.org Delivered-To: mongrel-unicorn@rubyforge.org Content-Disposition: inline In-Reply-To: <20100408235548.GA11184@dcvr.yhbt.net> User-Agent: Mutt/1.5.18 (2008-05-17) X-BeenThere: mongrel-unicorn@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: mongrel-unicorn-bounces@rubyforge.org Errors-To: mongrel-unicorn-bounces@rubyforge.org Xref: news.gmane.org gmane.comp.lang.ruby.unicorn.general:462 Archived-At: Received: from rubyforge.org ([205.234.109.19]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1O02wj-0001GD-GR for gclrug-mongrel-unicorn@m.gmane.org; Fri, 09 Apr 2010 03:23:45 +0200 Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 1AAF418582D4; Thu, 8 Apr 2010 21:23:44 -0400 (EDT) Received: from dcvr.yhbt.net (dcvr.yhbt.net [64.71.152.64]) by rubyforge.org (Postfix) with ESMTP id 653FA18582CE for ; Thu, 8 Apr 2010 21:20:51 -0400 (EDT) Received: from localhost (unknown [127.0.2.5]) by dcvr.yhbt.net (Postfix) with ESMTP id DCD951F4E1; Fri, 9 Apr 2010 01:20:50 +0000 (UTC) Eric Wong 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. > Jamie Wilkinson 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 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 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 - mongrel-unicorn@rubyforge.org http://rubyforge.org/mailman/listinfo/mongrel-unicorn Do not quote signatures (like this one) or top post when replying