From 9435ee2d5111394739b82d0f8a275deca8d505be Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 16 Sep 2009 23:04:37 -0700 Subject: SIGHUP no longer drops lone, default listener 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 --- lib/unicorn.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib') 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? -- cgit v1.2.3-24-ge0c7