Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Jun 2002 14:34:24 -0700 (PDT)
From:      Marc Slemko <marcs@znep.com>
To:        Julian Elischer <julian@elischer.org>
Cc:        net@FreeBSD.ORG
Subject:   Re: apache and option USE_FLOCK_SERIALIZED_ACCEPT
Message-ID:  <Pine.BSF.4.20.0206241429120.38173-100000@alive.znep.com>
In-Reply-To: <Pine.BSF.4.21.0206241416130.53897-100000@InterJet.elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 24 Jun 2002, Julian Elischer wrote:

> 
> for FreeBSD we seem to get this option set..
> 
> this seems bogus..
> 
> it assumes that multiple processes can't listen on the accept 
> at one time...

That is one use for accept serialization.

However, the other reason has to do with multiple listening sockets and
how Apache deals with them.

Apache does a select() on all listening sockets, waiting for a
connection to be ready on one.  eg. different virtual hosts.

That select() returns a set of sockets, we then do an accept() on one.

Without accept serialization, there is a race condition where one child 
could do the select(), then another child could come in, do the select()
do the accept() and accept the connection, then the first child's accept()
blocks.  If this happens too much, you end up with children blocked in 
accept() on one listening socket, which leaves no children to process 
requests from other listening sockets.

> does anyone know if FreeBSD is safe for having multiple processes do
> accept() on the same listenning socket?

Yes, it is.

FreeBSD also gets SINGLE_LISTEN_UNSERIALIZED_ACCEPT set, which says to 
not use accept serialization if you only have a single listen socket, since
then the above worry doesn't matter.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.20.0206241429120.38173-100000>