"unicorn -D" always returns 0 "success" (even when failed to load)
Iñaki Baz Castillo
ibc at aliax.net
Sat Dec 26 22:06:39 EST 2009
El Domingo, 27 de Diciembre de 2009, Eric Wong escribió:
> > Hi, I've improved it a bit with your suggestions and also simplified
> > it a lot. Now there is no a "controller process". Instead, if
> > "Unicorn.run" raises then master process rescues the exception and
> > sends USR1 to parent process so it exists with 1.
> Hi, I realized Unicorn.run inside the daemonize method doesn't work.
Strange, it works for me...
> However, I've reimplemented much of your idea here so it does not
> involve sleeping at all, but rather shares a pipe with the grandparent
> (started by the user) and Unicorn master process. The added benefit of
> using a pipe is that there's no fuzzy sleeping involved at or grace
> periods to worry about, too.
> Also pushed out to the "ready_pipe" branch of
> Let me know how it goes.
> If everything looks good, I'll consider merging for 0.96.0.
It's really awesome! I've tested it and it works great, and avoids the
sleeping stuff and a new commandlline option. Congratulations :)
However there is still a not solved case. Let me please explain it with two
1) In "after_fork" I set:
The master process would start properly and would notify "success" to
grandparent. (so the init script returns 0). But the fact is that all the
workers fail to start and are respawned again and again.
2) I use "Clogger" in my Rack config.ru. But I set a log file in a path that
doesn't exist. Clogger raises due to this (it doesn't try to create the full
Again the master process has notified "success" to grandparent (exis status 0
then) but the workers are respawned again and again.
In both cases, if "preload_app" is false then doing a "ps" I see new master
processes being created by first master process (with new workers) and all of
them die while new ones born.
If "preload_app" is false then there are no borning master processes as just
the workers fail to start when loading the Rack app.
It would be great if the same mechanims (master notifies to grandparent) would
be implemented between first process loading the Rack app (a worker if
"preload_app") and master process, so if the first worker fails when loading
the Rack app then master process doesn't notify "success" to grandparent and
exists (instead of respawning again and again the workers).
If "preload_app" is true then I don't understand why your new code doesn't
work right now. I expect that master process notifies "success" to grandparent
before loading the Rack app, am I right? would make sense master process to
wait until Rack app is loaded and if it fails then notify "error" and exit
Kind regards and thanks a lot for your great work.
Iñaki Baz Castillo <ibc at aliax.net>
More information about the mongrel-unicorn