Address already in use

Manuel Palenciano Guerrero mpalenciano at gmail.com
Mon Jun 25 21:03:28 UTC 2012


Hi,

First, thanks Eric, Jérémy and Aaron for replying. I really appreciate it.

Yes Eric, I can see the line... "inherited addr=/tmp/unicorn.app.sock fd=..."

here is the full log

-------------------------------------------------
I, [2012-06-21T11:40:44.282224 #29212]  INFO -- : inherited addr=/tmp/unicorn.sublimma_staging.sock fd=3
I, [2012-06-21T11:40:44.282480 #29212]  INFO -- : Refreshing Gem list
master process ready
worker=0 ready
worker=1 ready
reaped #<Process::Status: pid=28683,exited(0)> worker=0
reaped #<Process::Status: pid=28684,exited(0)> worker=1
master complete
E, [2012-06-21T11:40:46.386486 #29401] ERROR -- : adding listener failed addr=/tmp/unicorn.sublimma_staging.sock (in use)
E, [2012-06-21T11:40:46.386669 #29401] ERROR -- : retrying in 0.5 seconds (4 tries left)
E, [2012-06-21T11:40:46.887724 #29401] ERROR -- : adding listener failed addr=/tmp/unicorn.sublimma_staging.sock (in use)
E, [2012-06-21T11:40:46.887832 #29401] ERROR -- : retrying in 0.5 seconds (3 tries left)
E, [2012-06-21T11:40:47.388813 #29401] ERROR -- : adding listener failed addr=/tmp/unicorn.sublimma_staging.sock (in use)
E, [2012-06-21T11:40:47.388894 #29401] ERROR -- : retrying in 0.5 seconds (2 tries left)
E, [2012-06-21T11:40:47.889878 #29401] ERROR -- : adding listener failed addr=/tmp/unicorn.sublimma_staging.sock (in use)
E, [2012-06-21T11:40:47.889957 #29401] ERROR -- : retrying in 0.5 seconds (1 tries left)
E, [2012-06-21T11:40:48.390939 #29401] ERROR -- : adding listener failed addr=/tmp/unicorn.sublimma_staging.sock (in use)
E, [2012-06-21T11:40:48.391020 #29401] ERROR -- : retrying in 0.5 seconds (0 tries left)
E, [2012-06-21T11:40:48.892002 #29401] ERROR -- : adding listener failed addr=/tmp/unicorn.sublimma_staging.sock (in use)
/var/www/sublimma/staging/shared/bundle/ruby/1.8/gems/unicorn-4.3.0/lib/unicorn/socket_helper.rb:140:in `initialize': Address already in use - /tmp/unicorn.sublimma_staging.sock (Errno::EADDRINUSE)
-------------------------------------------------

my unicorn.rb: https://gist.github.com/2991110

and my production_init.sh: http://unicorn.bogomips.org/examples/init.sh

I was planning on trying the following...

adding the killing of the old_pid to the before_fork(), as in...

  old_pid = RAILS_ROOT + '/tmp/pids/unicorn.pid.oldbin'
  if File.exists?(old_pid) && server.pid != old_pid
    begin
      Process.kill("QUIT", File.read(old_pid).to_i)
    rescue Errno::ENOENT, Errno::ESRCH
      # someone else did our job for us
    end
  end

and making the UPGRADE case in the "init.sh" to just...

--------------------------------------------------
upgrade)
	sig USR2 && echo "Upgraded" && exit 0
	echo >&2 "Couldn't upgrade, starting '$CMD' instead"
	$CMD
	;;
--------------------------------------------------

Regards and thanks again !

Manuel P.

On Jun 25, 2012, at 10:28 PM, Eric Wong wrote:

> Manuel Palenciano Guerrero <mpalenciano at gmail.com> wrote:
>> Hello there,
>> 
>> I seem to have a problem with unix-sockets, and cannot see many people with the same situation when googling.
>> 
>> The problem is when upgrading (USR2 + QUIT) our applications. I get the following error very frequently but not always.
>> 
>> E, [2012-06-21T11:40:46.386486 #29401] ERROR -- : adding listener failed addr=/tmp/unicorn.app.sock (in use)
> 
> You should've seen an INFO message saying something like:
> 
>   inherited addr=/tmp/unicorn.app.sock fd=...
> 
> in your logs.
> 
> Can you share your unicorn config?  Are you using a before_exec hook
> at all and could that hook be clobbering ENV["UNICORN_FD"]?
> _______________________________________________
> Unicorn mailing list - mongrel-unicorn at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-unicorn
> Do not quote signatures (like this one) or top post when replying



More information about the mongrel-unicorn mailing list