Skip to content
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

Added QUIT for unicorn master (old) #26

Merged
merged 2 commits into from
Jul 16, 2012
Merged

Added QUIT for unicorn master (old) #26

merged 2 commits into from
Jul 16, 2012

Conversation

prognostikos
Copy link
Contributor

Don't know if this is useful for the main project, but I've added the ability for the restart task to automatically send QUIT to the old master process after sending USR2 to create a new master. This should close #20

@rauchy
Copy link
Contributor

rauchy commented Jul 14, 2012

+1 for this. Helped me get things working.

sosedoff added a commit that referenced this pull request Jul 16, 2012
Added QUIT for unicorn master (old)
@sosedoff sosedoff merged commit bafc12c into sosedoff:master Jul 16, 2012
@dkubb
Copy link

dkubb commented Jul 19, 2012

This commit seems to be causing problems for me when I have a unicorn process running and I execute "cap deploy".

What seems to be happening is the USR2 signal is sent, a new process starts and it dies trying to bind to a unix socket with an Errno::EADDRINUSE (Address already in use) error, then the QUIT signals is sent to the original process. In the end nothing is running.

I've experimented with long delays and infinite tries for the listen command in my unicorn config, which does not have any effect.

The only thing that seems to work is if I use the commit before this (747daa7), and add the following to the unicorn config's before_hook block:

old_pid = "#{server.config[:pid]}.oldbin"                                         
if File.exists?(old_pid) && old_pid != server.pid                                 
  begin                                                                           
    sig = worker.nr.succ >= server.worker_processes ? :QUIT : :TTOU               
    Process.kill(sig, File.read(old_pid).to_i)                                    
  rescue Errno::ENOENT, Errno::ESRCH                                              
  end                                                                             
end

Note that I have experimented with adding and removing this code with this latest commit, but neither have worked.

@sosedoff
Copy link
Owner

Im aware of this, working on refactoring. Thanks for the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

unicorn:reload after deploy:restart not useful for preloaded apps
5 participants