From: Eric Wong <normalperson@yhbt.net>
To: unicorn list <mongrel-unicorn@rubyforge.org>
Subject: Re: funky process tree + stillborn masters
Date: Thu, 8 Apr 2010 18:20:50 -0700 [thread overview]
Message-ID: <20100409012050.GA31641@dcvr.yhbt.net> (raw)
In-Reply-To: <20100408235548.GA11184@dcvr.yhbt.net>
Eric Wong <normalperson@yhbt.net> 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 <jamie@tramchase.com> 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 <normalperson@yhbt.net>
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 <normalperson@yhbt.net>
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
next prev parent reply other threads:[~2010-04-09 1:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-08 21:21 funky process tree + stillborn masters Jamie Wilkinson
2010-04-08 23:55 ` Eric Wong
2010-04-09 1:20 ` Eric Wong [this message]
2010-04-12 2:52 ` Eric Wong
2010-04-13 3:23 ` Jamie Wilkinson
2010-04-13 5:24 ` Eric Wong
2010-04-19 18:21 ` Eric Wong
2010-04-28 4:05 ` Jamie Wilkinson
2010-04-28 7:40 ` Eric Wong
2010-06-08 23:01 ` Jamie Wilkinson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://yhbt.net/unicorn/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100409012050.GA31641@dcvr.yhbt.net \
--to=normalperson@yhbt.net \
--cc=mongrel-unicorn@rubyforge.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhbt.net/unicorn.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).