Iñaki Baz Castillo <[email protected]> wrote:
> Hi, in my customized "unicorn" executable I create N forks in master process 
> to behave as posix_mq readers.
> 
> I added a "at_exit" block just in master process so they are killed when the 
> master receives a signal to terminate.
> 
> The only issue I'm experimenting is the fact that they are not killed if the 
> master process receives a KILL signal. However Unicorn workers are terminated 
> after master is killed with KILL signal. Could I know how such cool feature 
> is 
> implemented?
> 
> AFAIK when a process receives a KILL signal it just dies and cannot capture 
> such signal so this should be a feature implemented in workers (in some way 
> they can detect if master has died, am I right?). If so, could I be pointed 
> to 
> the exact code in which the feature is implemented? I would like to replicate 
> it in my extra-processes.
> 

Hi Iñaki,

The worker_loop just compares Process.ppid with the original ppid it
was started with.  They wakeup from IO.select() every timeout/2 seconds
to check for original_ppid != ppid if the server is idle.

-- 
Eric Wong
_______________________________________________
Unicorn mailing list - [email protected]
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

Reply via email to