Why doesn't SIGTERM quit gracefully?

Andreas Falk mail at andreasfalk.se
Thu Apr 25 11:02:52 UTC 2013


On Thu, Apr 25, 2013 at 10:51 AM, Eric Wong <normalperson at yhbt.net> wrote:
> Andreas Falk <mail at 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 at 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


More information about the mongrel-unicorn mailing list