unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Graham Christensen <graham@grahamc.com>
To: mongrel-unicorn@rubyforge.org
Subject: Re: Unicorn + RUnit Rails Not Killing Old Master
Date: Mon, 20 May 2013 13:51:18 -0400	[thread overview]
Message-ID: <kndnqg$77h$1@ger.gmane.org> (raw)
In-Reply-To: 20130520172851.GA25247@dcvr.yhbt.net

On 2013-05-20 17:28:51 +0000, Eric Wong said:

> Graham Christensen <graham@grahamc.com> wrote:
>> I'm deploying Unicorn on a Rails application with RUnit. Technically
>> I'm using Chef's deployment tools, if any of you are familiar with
>> it (https://github.com/opscode-cookbooks/application_ruby) but to be
>> clear they aren't doing anything magical, so this is purely an issue
>> with RUnit and Unicorn.
>> 
>> The TL;DR of the following post, which has lots of pastes (linking
>> to pastebins for easier reading:) when I run /etc/init.d/myzippykid
>> restart, the old unicorn master fails to die, causing the new master
>> to be stuck in a loop waiting to own port 8080. The new master never
>> takes over, as the old master never dies. When I manually kill the
>> master, the new one takes over just fine.
>> 
>> What am I missing in my restart process to make the old master exit?
> 
> It seems you're missing /etc/init.d/myzippykid in your pastes.

The /etc/init.d/myzippykid is symlinked to /usr/bin/sv which is a 
binary provided by runit.

> 
> Are you sending SIGQUIT (or SIGTERM) to the old unicorn master?
> If you have old workers servicing requests, the old master will wait
> until all the old workers are done.

This is an interesting question. runit appear to be capturing the PID 
of my bundle_wrapper.sh instead of the spawned unicorn process. Since 
this isn't interactive, it probably isn't forwarding the signals to 
Unicorn. After replacing the `bundle $@` with `exec bundle $@`, and 
therefore replacing the process with the unicorn command, it all works 
as intended.

I suppose all it took was that question to jog my memory.

I appreciate your assistance! Here is the complete bundle_wrapper.sh 
wthich implements everything as intended:
#!/bin/bash

source /etc/profile.d/rbenv.sh

exec bundle $@

> 
> Since your timeout is 60s, everything (workers and master) should exit
> around that time period if you have stalled/long-running requests,
> though.

Since Unicorn doen't seem to be receiving the signals, this would 
explain why the timeout never was hit, and nothing ever exited.

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

Thank you a lot!

Graham Christensen


_______________________________________________
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-05-20 17:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-20 16:46 Unicorn + RUnit Rails Not Killing Old Master Graham Christensen
2013-05-20 17:28 ` Eric Wong
2013-05-20 17:51   ` Graham Christensen [this message]

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='kndnqg$77h$1@ger.gmane.org' \
    --to=graham@grahamc.com \
    --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).