unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: "Iñaki Baz Castillo" <ibc@aliax.net>
To: mongrel-unicorn@rubyforge.org
Subject: Re: 'before_fork' is executed in parallel by two processes  ¿?
Date: Wed, 6 Jan 2010 00:04:40 +0100	[thread overview]
Message-ID: <201001060004.40416.ibc@aliax.net> (raw)
In-Reply-To: <201001052349.43567.ibc@aliax.net>

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@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


  parent reply	other threads:[~2010-01-05 23:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-05 10:44 'before_fork' is executed in parallel by two processes ¿? Iñaki Baz Castillo
2010-01-05 11:03 ` Iñaki Baz Castillo
2010-01-05 11:33   ` Iñaki Baz Castillo
2010-01-05 21:51     ` Eric Wong
2010-01-05 22:49       ` Iñaki Baz Castillo
2010-01-05 22:57         ` Eric Wong
2010-01-05 23:30           ` Iñaki Baz Castillo
2010-01-05 23:55             ` Eric Wong
2010-01-06  0:33               ` Iñaki Baz Castillo
2010-01-06  1:12                 ` Eric Wong
2010-01-05 23:04         ` Iñaki Baz Castillo [this message]
2010-01-07 15:26       ` Iñaki Baz Castillo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/unicorn/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201001060004.40416.ibc@aliax.net \
    --to=ibc@aliax.net \
    --cc=mongrel-unicorn@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).