From: Devin Ben-Hur <dbenhur@whitepages.com>
To: unicorn list <mongrel-unicorn@rubyforge.org>
Cc: phc@zestcash.com, ajsharp@gmail.com
Subject: Re: How to automate the restarting of Unicorn?
Date: Sun, 9 Oct 2011 23:04:13 -0700 [thread overview]
Message-ID: <4E928ADD.8040900@whitepages.com> (raw)
In-Reply-To: <D0C8FD0B85DE4305A1EC0EE8B872A1A7@gmail.com>
On 10/09/2011 04:31 PM, Alex Sharp wrote:
> On Friday, October 7, 2011 at 8:20 PM, Pai-Hung Chen wrote:
>> My question is: By the time the "before_exec" hook is executed, is it
>> guaranteed that unicorn.pid.oldbin ahas lready created (otherwise we
>> have a racing condition here)? Or is there a better way to achieve
>> what I want?
> I'm not 100% positive, but about 98% -- yes, you can count on the fact that the *.oldbin file will exist on disk before the before_exec block is executed. Eric can confirm this, but I've never had a problem with it...
No need to rely on authority, just read the source:
https://github.com/defunkt/unicorn/blob/master/lib/unicorn/http_server.rb
Unicorn::HttpServer#pid=(path) setter writes the pid file (lines 179-206).
before_exec is called on line 439 within a fork block in
Unicorn::HttpServer#reexec (this is the only call to before_exec in the
code)
prior to that, self.pid= is called passing oldpid whose value is
"#{pid}.oldbin" (lines 398-401).
[ line numbers may change if you're not looking at commit c7ba76a21c ]
_______________________________________________
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
next prev parent reply other threads:[~2011-10-10 6:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-08 3:20 How to automate the restarting of Unicorn? Pai-Hung Chen
2011-10-09 23:31 ` Alex Sharp
2011-10-10 6:04 ` Devin Ben-Hur [this message]
2011-10-10 20:34 ` Pai-Hung Chen
2011-10-10 21:27 ` Eric Wong
2011-10-10 22:18 ` Pai-Hung Chen
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=4E928ADD.8040900@whitepages.com \
--to=dbenhur@whitepages.com \
--cc=ajsharp@gmail.com \
--cc=mongrel-unicorn@rubyforge.org \
--cc=phc@zestcash.com \
/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).