yahns Ruby server user/dev discussion
 help / color / mirror / code / Atom feed
* [PATCH] support SIGWINCH even if not daemonized
@ 2015-06-05  9:01 Eric Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2015-06-05  9:01 UTC (permalink / raw)
  To: yahns-public; +Cc: Eric Wong

This has no effect for the (default) single process case with
no master/worker relationship as that does not support SIGWINCH.

Some process managers such as foreman and daemontools rely on
yahnsnot daemonizing, but we still want to be able to process
SIGWINCH in that case.

stdout and stderr may be redirected to a pipe (for cronolog or
similar process), so those are less likely to be attached to a TTY
than stdin.  This also allows users to process SIGWINCH when running
inside a regular terminal if they redirect stdin to /dev/null.

This follows unicorn commit a6077391bb62d0b13016084b0eea36b987afe8f0
Thanks to Dan Moore for suggesting it on the unicorn list.
---
 lib/yahns/server_mp.rb | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/yahns/server_mp.rb b/lib/yahns/server_mp.rb
index 2e9da20..9e6ec60 100644
--- a/lib/yahns/server_mp.rb
+++ b/lib/yahns/server_mp.rb
@@ -103,13 +103,13 @@ module Yahns::ServerMP # :nodoc:
       when :USR2 # exec binary, stay alive in case something went wrong
         reexec
       when :WINCH
-        if @daemon_pipe
+        if $stdin.tty?
+          @logger.info "SIGWINCH ignored because we're not daemonized"
+        else
           state = :WINCH
           @logger.info "gracefully stopping all workers"
           soft_kill_each_worker("QUIT")
           @worker_processes = 0
-        else
-          @logger.info "SIGWINCH ignored because we're not daemonized"
         end
       when :TTIN
         state = :respawn unless state == :QUIT
-- 
EW


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] support SIGWINCH even if not daemonized
@ 2015-06-05  9:10 Eric Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2015-06-05  9:10 UTC (permalink / raw)
  To: yahns-public; +Cc: Eric Wong

This has no effect for the (default) single process case with
no master/worker relationship as that does not support SIGWINCH.

Some process managers such as foreman and daemontools rely on
yahnsnot daemonizing, but we still want to be able to process
SIGWINCH in that case.

stdout and stderr may be redirected to a pipe (for cronolog or
similar process), so those are less likely to be attached to a TTY
than stdin.  This also allows users to process SIGWINCH when running
inside a regular terminal if they redirect stdin to /dev/null.

This follows unicorn commit a6077391bb62d0b13016084b0eea36b987afe8f0
Thanks to Dan Moore for suggesting it on the unicorn list.
---
 lib/yahns/server_mp.rb | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/yahns/server_mp.rb b/lib/yahns/server_mp.rb
index 2e9da20..9e6ec60 100644
--- a/lib/yahns/server_mp.rb
+++ b/lib/yahns/server_mp.rb
@@ -103,13 +103,13 @@ module Yahns::ServerMP # :nodoc:
       when :USR2 # exec binary, stay alive in case something went wrong
         reexec
       when :WINCH
-        if @daemon_pipe
+        if $stdin.tty?
+          @logger.info "SIGWINCH ignored because we're not daemonized"
+        else
           state = :WINCH
           @logger.info "gracefully stopping all workers"
           soft_kill_each_worker("QUIT")
           @worker_processes = 0
-        else
-          @logger.info "SIGWINCH ignored because we're not daemonized"
         end
       when :TTIN
         state = :respawn unless state == :QUIT
-- 
EW


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-05  9:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-05  9:01 [PATCH] support SIGWINCH even if not daemonized Eric Wong
2015-06-05  9:10 Eric Wong

Code repositories for project(s) associated with this inbox:

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