From owner-freebsd-net Mon Jun 24 14:34:32 2002 Delivered-To: freebsd-net@freebsd.org Received: from alive.znep.com (sense-sea-MegaSub-1-448.oz.net [216.39.145.194]) by hub.freebsd.org (Postfix) with ESMTP id A75B037B401 for ; Mon, 24 Jun 2002 14:34:27 -0700 (PDT) Received: from localhost (marcs@localhost) by alive.znep.com (8.9.3/8.9.3) with ESMTP id OAA88437; Mon, 24 Jun 2002 14:34:24 -0700 (PDT) (envelope-from marcs@znep.com) Date: Mon, 24 Jun 2002 14:34:24 -0700 (PDT) From: Marc Slemko To: Julian Elischer Cc: net@FreeBSD.ORG Subject: Re: apache and option USE_FLOCK_SERIALIZED_ACCEPT In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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