unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* [PATCH] SIGHUP no longer drops lone, default listener
@ 2009-09-17  6:04 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2009-09-17  6:04 UTC (permalink / raw)
  To: mongrel-unicorn

The following patch (or something functionally equivalent) along with
some sort of test case will be in the next release of Unicorn (due this
week along with more documentation updates).

Until then, if you're not explicitly specifying a listener anywhere,
specify one, even if it's the default (preferably in the config file) if
you plan on using SIGHUP to reload configs.

Just add the following line to your config file:

	listen 8080

>From beefdb590c4cae9671bd96bf94962634ecbc6161 Mon Sep 17 00:00:00 2001
From: Eric Wong <normalperson@yhbt.net>
Date: Wed, 16 Sep 2009 22:31:20 -0700
Subject: [PATCH] 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 (TCP port 8080), did not get preserved and
reinjected 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
listeners with a configuration file reload.  We also need to
preserve the (unspecified) default listener across upgrades that
later result in SIGHUP, too; so we inject the default listener
into the command-line for upgrades.
---
 lib/unicorn.rb |    2 ++
 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?
-- 
Eric Wong

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-09-17  6:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-17  6:04 [PATCH] SIGHUP no longer drops lone, default listener Eric Wong

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).