unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* Unicorn in the jail
@ 2011-08-03 16:41 Tatsuya Ono
  2011-08-03 18:03 ` Eric Wong
  0 siblings, 1 reply; 3+ messages in thread
From: Tatsuya Ono @ 2011-08-03 16:41 UTC (permalink / raw)
  To: mongrel-unicorn

I ran into a problem when sending USR2 signal to master process which
is listening a TCP port. It shows the following error in log.

err: adding listener failed addr= (in use)

I found similar error reported on this mailing list and yes, the host
I got the error was in the FreeBSD jail.

I dug into the problem and found some interesting thing. I want to
share it and the solution here.

* Why does it happen in the Jail?
When you bind address to the socket on a Jail host, Jail
doesn't bind Instead of it, it binds to the IP address of the
host such as,, etc.
Then the problem happens in Unicorn::HttpServer#inherit_listeners!
when it gets signal like USR2.

Here you get (for example) as inherited address from
ENV['UNICORN_FD'] but So Unicorn tries to bind to
(again) at line 728. Then it fails because it is actually in use.

* How to solve the issue?
Thankfully unicorn.conf is ruby script so that I could write a logic
for Jail hosts without specifying IP address of those hosts (which we
want to avoid since we deploy it multiple servers). I share the
configuration file.

Then Unicorn flies in the jail happily.

Tatsuya Ono
Unicorn mailing list - mongrel-unicorn@rubyforge.org
Do not quote signatures (like this one) or top post when replying

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-08-03 22:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-03 16:41 Unicorn in the jail Tatsuya Ono
2011-08-03 18:03 ` Eric Wong
2011-08-03 21:57   ` Tatsuya Ono

Code repositories for project(s) associated with this public inbox


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).