-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unicorn:restart sends QUIT to old master before new master's workers are up #40
Comments
I have the same issue. I tried removing the lines that quit the old process from the restart job and then it seems to work. However, I am not proficient with Unicorn either so I don't know if this is a good idea. |
@MrCheese I did the same thing in the end in a fork. Works mostly great, but the old master takes some time to finally die I noticed (5-30 seconds). Maybe that's related. miepleinc@4944cab |
@sosedoff Thanks so much for merging #41 -- this issue also probably needs some review. There are perhaps half a dozen forks that fix the problem (we're using one in production right now). The issue is that the QUIT signal really should not be sent as described in this issue's description. We are using this branch: Which corrects the issue. Here's the specific commit that fixes it: So we could close #40 if we merged in that commit above. |
I have filed issue #45 regarding the number of forks. |
Agree with @DavidAllison's comment that QUIT is intended to be used differently. Note that in the example unicorn.rb referenced in the README the QUIT signal is sent to the old master after the first child of the new master forks -- this is how the QUIT is supposed to be handled. From the Unicorn SIGNALS documentation: I agree that the commit referenced by @DavidAllison above would resolve the issue. I'd be happy to make this a pull request with the update if it would help -- just let me know. And thanks for maintaining this repo, @sosedoff, it's been quite helpful! |
Hey guys - any update on this? Would love to see miepleinc/capistrano-unicorn merged in to @sosedoff's main repo! :) |
A recent commit provides a solution for this issue by adding a new task: @sosedoff what's the reasoning for keeping the Since there is a workaround now supported should we consider this issue closed? |
@rylwin @sosedoff -- I'm happy to use |
According to Unicorn docs: Where that QUIT is sent is left open to interpretation, BUT, the sample config file shows it being done this way, where QUIT is sent when the last former child of the old master dies, however commented out by default. To support zero downtime is to me part of Unicorn's goals so this flow makes more sense to me, but so long as there's a way to make it work through another option (i.e. unicorn:duplicate) that's fine by me. |
So are we all agreed this can be closed now? |
@rylwin, @DavidAllison, @sosedoff, @xevix: Proposal: Make Reasoning: (I haven't taken a look at it yet, this would work if |
I really like that proposal. It's exactly what I would hope for in terms of the semantics of the commands. On Mar 19, 2013, at 1:43 PM, Sathya Sekaran [email protected] wrote:
|
@sfsekaran That works. |
I've been investigating a fix for this, and I'm not entirely sure we should even stop old master manually. We should most likely be doing the standard solution (one I've implemented before) referenced here: So, once you've added the proper The biggest benefits of this being a) cap deploy command returns much faster and b) zero downtime. Perhaps we could provide a sample I'll be working on this in the next day or two and I'll provide a pull request for you guys to review. |
@sfsekaran this repo already contains a sample unicorn.rb: https://github.com/sosedoff/capistrano-unicorn/blob/master/examples/rails3.rb. @sosedoff it would be great to get your input on this discussion |
Here's how I actually implemented it:
This worked flawlessly and is on production. Next step is to fix |
FYI, I don't foresee working on a change for this soon (since the standard solution I implemented works so well). If anyone who needs it wants to write the shell code to wait for new master to be up and running before killing the old, then please don't hesitate. |
#121 double ; make a syntax error sosedoff#40 try to execute unicorn in a local context
First, thanks for the lib, this is pretty handy. Just a quick question. I saw this pull request merged in that I think added this behavior.
#26
And in the sample unicorn file here there is also a QUIT sent to the old master:
https://github.com/sosedoff/capistrano-unicorn/blob/master/examples/rails3.rb
When I run
cap unicorn:restart
the task properly sends the USR2 to the old master, sleeps 2 seconds, then sends a QUIT to the old master. At this point, the workers of the new master are not yet up, so there are no workers left to handle the request, and web browsers that had started a request sit idly by. If one of the useful things of Unicorn is to have no downtime for handling requests, why is this the behavior? I'm a bit new to Unicorn as well, so please let me know if I have the wrong expectation here. Thanks.The text was updated successfully, but these errors were encountered: