[ANN] Rainbows! 4.0.0 - MOAR concurrency for MOAR COARS

Eric Wong normalperson at yhbt.net
Wed Jun 29 03:19:05 EDT 2011


Eric Wong <normalperson at yhbt.net> wrote:
> ghazel at gmail.com wrote:
> > I can't seem to upgrade from rainbows-3.4.0 to rainbows-4.0.0. I see:
> > 
> > #<NoMethodError: undefined method `expand_addr' for nil:NilClass>
> 
> That's odd, what configuration options and Ruby version are you
> using?  Are you using a per-worker listen socket?

This should fix it, the test case for this was broken, too :<

diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index 02ba965..78d80b4 100644
--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
@@ -453,7 +453,7 @@ class Unicorn::HttpServer
   def after_fork_internal
     @ready_pipe.close if @ready_pipe
     Unicorn::Configurator::RACKUP.clear
-    @ready_pipe = @init_listeners = @config = @before_exec = @before_fork = nil
+    @ready_pipe = @init_listeners = @before_exec = @before_fork = nil
 
     srand # http://redmine.ruby-lang.org/issues/4338
 
@@ -545,6 +545,7 @@ class Unicorn::HttpServer
     after_fork.call(self, worker) # can drop perms
     worker.user(*user) if user.kind_of?(Array) && ! worker.switched
     self.timeout /= 2.0 # halve it for select()
+    @config = nil
     build_app! unless preload_app
   end
 
diff --git a/test/exec/test_exec.rb b/test/exec/test_exec.rb
index 0f6b083..8c33457 100644
--- a/test/exec/test_exec.rb
+++ b/test/exec/test_exec.rb
@@ -516,7 +516,7 @@ EOF
     File.unlink(tmp.path)
     ucfg = Tempfile.new('unicorn_test_config')
     ucfg.syswrite("listen '#@addr:#@port'\n")
-    ucfg.syswrite("before_fork { |s,w|\n")
+    ucfg.syswrite("after_fork { |s,w|\n")
     ucfg.syswrite("  s.listen('#{tmp.path}', :backlog => 5, :sndbuf => 8192)\n")
     ucfg.syswrite("  s.listen('#@addr:#{port2}', :rcvbuf => 8192)\n")
     ucfg.syswrite("\n}\n")
-- 
Eric Wong


More information about the rainbows-talk mailing list