"unicorn -D" always returns 0 "success" (even when failed to load)

Iñaki Baz Castillo ibc at aliax.net
Mon Dec 28 15:17:27 EST 2009

El Lunes, 28 de Diciembre de 2009, Eric Wong escribió:
> > As a suggestion, could the grandparent rescue such exception and display
> > some  kind of error message?:
> > 
> >   "The master couldn't be started. Inspect the log error or run in
> > foreground"
> Thanks, pushed out to the ready_pipe branch of unicorn.git

Hi, I attach a minor patch to make the error more verbose when Unicorn cannot
listen in a socket.

For example, as normal user (not root) I try to listen in a UNIX socket (ok)
and also on TCP port 84 (permission error). Actually I would see this error log:

I, [2009-12-28T21:05:31.503533 #26137]  INFO -- : unlinking existing socket=/tmp/unicorn.sock
I, [2009-12-28T21:05:31.504019 #26137]  INFO -- : listening on addr=/tmp/unicorn.sock fd=3
/usr/local/lib/ruby1.9/site_ruby/1.9.1/unicorn/socket_helper.rb:110:in `initialize': Permission denied - bind(2) (Errno::EACCES)

By inspecting the error it seems that the problem is in the UNIX socket.

With my patch the log would be:

I, [2009-12-28T21:11:18.165918 #26589]  INFO -- : unlinking existing socket=/tmp/openxdms.sock
I, [2009-12-28T21:11:18.166228 #26589]  INFO -- : listening on addr=/tmp/openxdms.sock fd=3
F, [2009-12-28T21:11:18.166632 #26589] FATAL -- : error adding listener addr=
/usr/local/lib/ruby1.9/site_ruby/1.9.1/unicorn/socket_helper.rb:110:in `initialize': Permission denied - bind(2) (Errno::EACCES)

I hope it's useful. Regards.

Iñaki Baz Castillo <ibc at aliax.net>

More information about the mongrel-unicorn mailing list