"unicorn -D" always returns 0 "success" (even when failed to load)
normalperson at yhbt.net
Sat Dec 26 01:16:52 EST 2009
Iñaki Baz Castillo <ibc at aliax.net> wrote:
> El Sábado, 26 de Diciembre de 2009, Iñaki Baz Castillo escribió:
> > I'm playing right now with unicorn/launcher.rb (daemonize! method)but I
> > get nothing. Unfortunatelly I think that the usage of fork makes very
> > difficult the main command to behave as I desire (exit status).
> > If you could give me some tips I'd try to implement it.
> I've implemented it! :)
> If you are interested please review this file (I cannot attach it in the mail
> as it's rejected by the maillist):
> It contains a modification for bin/unicorn and a rewritten
Interesting, I could be tempted to accept this with a few changes...
Process.detach() spawns a background Thread. Having running threads
before forking won't fly with certain OS threading libraries (some
versions of FreeBSD, I believe, check MRI Redmine for some open bugs).
What you're trying to accomplish does not require threads.
Use trap(Symbol), trap(Integer) is harder to read and has a likelyhood
of being non-portable for certain signals. Likewise with Process.kill
(0 being the only exception, of course).
I would trap() in the parent before any forking, in case the
sleep time is ever so low there's a race condition. Probably no
need to handle USR1, either, just let the parent die on its own,
or alternatively, have the parent sleep forever in case something
unforseen happens in the children...
> The code works for me for the two cases I explained in my previous mail.
> Of course it's an optional feature (I've implemented it with "-M --min-
> running-time SECONDS" in the options parser).
I believe the nginx grace period is hard-coded at 5 seconds, which should
More information about the mongrel-unicorn