Address already in use
aaron at ktheory.com
Mon Jun 25 13:42:56 UTC 2012
On Monday, June 25, 2012 at 9:02 AM, Manuel Palenciano Guerrero wrote:
> The problem is when upgrading (USR2 + QUIT) our applications. I get the following error very frequently but not always.
> E, [2012-06-21T11:40:48.892002 #29401] ERROR -- : adding listener failed addr=/tmp/unicorn.app.sock (in use)
> /var/www/app/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.app.sock (Errno::EADDRINUSE)
> ...and the only way around that I know is stoping and starting the app, even in production.
I've run in to this problem using the included example init.sh script. The `sleep 2` on line 48 is too short in some cases. (http://bogomips.org/unicorn.git/tree/examples/init.sh#n48)
I use a patched example init script that uses `ps` to monitor the upgrade process instead of sleeping:
It works well for me.
P.S. I've tried to contribute the patch upstream via this list, but it keeps getting rejected for having the wrong content type. Then I gave up. I'm fine chalking it up to my own stupidity/laziness…just wanted to put it out there that contributing could be easier. :-)
More information about the mongrel-unicorn