about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-09-16 23:04:37 -0700
committerEric Wong <normalperson@yhbt.net>2009-09-17 11:55:53 -0700
commit9435ee2d5111394739b82d0f8a275deca8d505be (patch)
treec1249fd0fd9ea51aa8e7284d6c434acc94d4a8b6 /lib
parent04c7fc37ab4fb2fbaa1b4a2570871713cf9d1319 (diff)
downloadunicorn-9435ee2d5111394739b82d0f8a275deca8d505be.tar.gz
When SIGHUP reloads the config, we didn't account for the case
where the listen socket was completely unspecified.  Thus the
default listener (0.0.0.0:8080), did not get preserved and
re-injected into the config properly.

Note that relying on the default listen or specifying listeners
on the command-line means it's /practically/ impossible to
_unbind_ those listeners with a configuration file reload.  We
also need to preserve the (unspecified) default listener across
upgrades that later result in SIGHUP, too; so the easiest way is
to inject the default listener into the command-line for
upgrades.

Many thanks to James Golick for reporting and helping me track
down the bug since this behavior is difficult to write reliable
automated tests for.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/unicorn.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/unicorn.rb b/lib/unicorn.rb
index 4cc5c2d..0e46261 100644
--- a/lib/unicorn.rb
+++ b/lib/unicorn.rb
@@ -110,6 +110,8 @@ module Unicorn
       config_listeners -= listener_names
       if config_listeners.empty? && LISTENERS.empty?
         config_listeners << Unicorn::Const::DEFAULT_LISTEN
+        init_listeners << Unicorn::Const::DEFAULT_LISTEN
+        START_CTX[:argv] << "-l#{Unicorn::Const::DEFAULT_LISTEN}"
       end
       config_listeners.each { |addr| listen(addr) }
       raise ArgumentError, "no listeners" if LISTENERS.empty?