El Sábado, 26 de Diciembre de 2009, Iñaki Baz Castillo escribió: > El Sábado, 26 de Diciembre de 2009, Eric Wong escribió: > > > http://oversip.net/public/min_time_running.rb > > > > > > It contains a modification for bin/unicorn and a rewritten > > > lib/unicorn/launcher.rb. > > > > 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). > > Yes, but there is a problem: > Imagine I don't use Process.detach and the master process ends when loads > the rack application (due to a typo or due to an error in unicorn conf > file). Then the master process would remain visible/alive but as zombie. > If so, when the controller process sends signal 0 to check the master > process it will always receive 'true' (a zombie process is a process which > can receive signals, it's does exist).
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. So, Process.detach is not used anymore :) Please check it from here: http://oversip.net/public/unicorn_addons.rb > > 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). Done in new code. > > I would trap() in the parent before any forking, in case the > > sleep time is ever so low there's a race condition. Done in new code. > > Probably no need to handle USR1, either, just let the parent die on its > > own, Now just one signal plays: USR1. It is sent by master process to parent process if Unicorn.run raised an exception. Regards. -- Iñaki Baz Castillo <i...@aliax.net> _______________________________________________ Unicorn mailing list - mongrel-unicorn@rubyforge.org http://rubyforge.org/mailman/listinfo/mongrel-unicorn Do not quote signatures (like this one) or top post when replying