unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* Why doesn't SIGTERM quit gracefully?
@ 2013-04-25  8:02 Andreas Falk
  2013-04-25  8:51 ` Eric Wong
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Falk @ 2013-04-25  8:02 UTC (permalink / raw)
  To: mongrel-unicorn

Hi,

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

Regards,
Andreas Falk
_______________________________________________
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

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

* Re: Why doesn't SIGTERM quit gracefully?
  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
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Wong @ 2013-04-25  8:51 UTC (permalink / raw)
  To: unicorn list; +Cc: mail

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

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

* Re: Why doesn't SIGTERM quit gracefully?
  2013-04-25  8:51 ` Eric Wong
@ 2013-04-25 11:02   ` Andreas Falk
  2013-04-25 18:09     ` Eric Wong
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Falk @ 2013-04-25 11:02 UTC (permalink / raw)
  To: Eric Wong; +Cc: unicorn list

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? The developers behind
resque reasoned in a similar way in regards to nginx but changed it
after a while. You can read more about it here
<https://github.com/resque/resque/issues/368> and in the referenced
issues.

The change i'd like to see is to preferably have SIGTERM and SIGQUIT
swap places but at least move SIGTERM to do the same thing as SIGQUIT
do now (graceful exit).

I may be wrong but i feel that the change shouldn't completely break
anything (since it would still exit, just take a bit longer) and
switching some signals around in the nginx scripts shouldn't be that
much work? Also some people are probably using SIGINT already and
wouldn't be affected. I think the benefit in the long run of being in
line with the "standard" outweighs the hassle of converting a few
scripts.

Also perhaps with some luck the nginx developers will pick on the
changes in other software and switch theirs around too!

Thanks for a really great tool anyway!

Andreas
_______________________________________________
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

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

* Re: Why doesn't SIGTERM quit gracefully?
  2013-04-25 11:02   ` Andreas Falk
@ 2013-04-25 18:09     ` Eric Wong
  2013-04-25 20:45       ` Andreas Falk
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Wong @ 2013-04-25 18:09 UTC (permalink / raw)
  To: unicorn list; +Cc: Andreas Falk

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

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

* Re: Why doesn't SIGTERM quit gracefully?
  2013-04-25 18:09     ` Eric Wong
@ 2013-04-25 20:45       ` Andreas Falk
  0 siblings, 0 replies; 5+ messages in thread
From: Andreas Falk @ 2013-04-25 20:45 UTC (permalink / raw)
  To: Eric Wong; +Cc: unicorn list

On Thu, Apr 25, 2013 at 8:09 PM, Eric Wong <normalperson@yhbt.net> wrote:
> If nginx developers are willing to change this, definitely.

I guess I'll go camp out among some nginx developers then.

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

Hehe, i hear you! Maybe a unicorn 5 or do you have any plans for
something completely new :)? I guess i'll have to wait and see.

Thanks for the help!

Andreas
_______________________________________________
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

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

end of thread, other threads:[~2013-04-25 20:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2013-04-25 20:45       ` Andreas Falk

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