'before_fork' is executed in parallel by two processes ¿?

Iñaki Baz Castillo ibc at aliax.net
Tue Jan 5 18:04:40 EST 2010


El Martes, 5 de Enero de 2010, Iñaki Baz Castillo escribió:
> I confirm that there are two lines printed in that file when Unicorn starts 
> (being 2 the number of workers). Is it the expected behavior?

Simpler example:

-----------------
worker_processes 3

before_fork do |server, worker|
  puts "*** I'my PID #{$$}"
end
----------------


Then run Unicorn in foreground and I see:

  *** I'm PID 8791
  *** I'm PID 8791
  *** I'm PID 8791

8791 is the PID of the master process, so yes, it seems that workers don't 
exist yet in before_fork (as obviously expected). However the block into 
before_fork is executed "worker_processes" times by master process.

Do I miss something?

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


More information about the mongrel-unicorn mailing list