unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: unicorn list <mongrel-unicorn@rubyforge.org>
Cc: Andreas Falk <mail@andreasfalk.se>
Subject: Re: Why doesn't SIGTERM quit gracefully?
Date: Thu, 25 Apr 2013 18:09:51 +0000	[thread overview]
Message-ID: <20130425180951.GA13284@dcvr.yhbt.net> (raw)
In-Reply-To: <CADw67XD3mkchvntEpO9pZJV3W1YKQfNvDeaQ90XBOOQxC642cQ@mail.gmail.com>

Andreas Falk <mail@andreasfalk.se> wrote:
> On Thu, Apr 25, 2013 at 10:51 AM, Eric Wong <normalperson@yhbt.net> wrote:
> > Andreas Falk <mail@andreasfalk.se> wrote:
> >> I'm wondering why SIGINT and SIGTERM both were chosen for the quick
> >> shutdown? I agree with SIGINT but not with SIGTERM. A lot of unix
> >> tools send SIGTERM as default (kill, runit among some) and it seems to
> >> be the standard way of telling a process to quit gracefully but not
> >> among Ruby people (there are a few other ruby processes behaving the
> >> same way). I just think it's weird that the default command will exit
> >> without taking care of their current request.
> >>
> >> Also i'm not on the mailinglist so it would be great if you could cc
> >> mail@andreasfalk.se
> >
> > I think it's weird, too.  But that's what nginx does, and I based most
> > of the UI decisions on nginx (so it's easy to reuse nginx scripts
> > with unicorn).
> 
> Is it something you'd be willing to change?

If nginx developers are willing to change this, definitely.

Otherwise, at this point, I'm not certain what the ramifications of a
change would be to existing users.  Maybe an option would work, but too
many options overwhelms people.

With unicorn, I suppose having the following after_fork hook works:

   # Note: after_fork hook is run before the :QUIT handler is installed,
   # so we can't use the result of trap(:QUIT) at this point:
   after_fork do |server,worker|
     trap(:TERM) { Process.kill(:QUIT, $$) }
   end

If I had to do this all over again[1], graceful shutdown would be the
_only_ option.

[1] - I haven't released a new web server for 2013... yet :)
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

  reply	other threads:[~2013-04-25 18:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-25  8:02 Why doesn't SIGTERM quit gracefully? Andreas Falk
2013-04-25  8:51 ` Eric Wong
2013-04-25 11:02   ` Andreas Falk
2013-04-25 18:09     ` Eric Wong [this message]
2013-04-25 20:45       ` Andreas Falk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/unicorn/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130425180951.GA13284@dcvr.yhbt.net \
    --to=normalperson@yhbt.net \
    --cc=mail@andreasfalk.se \
    --cc=mongrel-unicorn@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).