Return-Path: Delivered-To: apmail-new-httpd-archive@apache.org Received: (qmail 30518 invoked by uid 500); 13 Aug 2001 19:07:16 -0000 Mailing-List: contact new-httpd-help@apache.org; run by ezmlm Precedence: bulk Reply-To: new-httpd@apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list new-httpd@apache.org Received: (qmail 30474 invoked from network); 13 Aug 2001 19:07:15 -0000 X-Authentication-Warning: rdu26-58-158.nc.rr.com: trawick set sender to trawick@attglobal.net using -f Sender: trawick@rdu26-58-158.nc.rr.com To: Shail Bhatnagar Cc: new-httpd@apache.org Subject: Re: Spurious return from select() References: <3B6ECBF7.61F38773@cisco.com> <3B714E46.416F700A@cisco.com> <3B734813.2EEF18FA@cisco.com> From: Jeff Trawick Date: 13 Aug 2001 14:56:15 -0400 In-Reply-To: <3B734813.2EEF18FA@cisco.com> Message-ID: Lines: 34 User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N Status: O X-Status: X-Keywords: X-UID: 532 Shail Bhatnagar writes: > Jeff, The recvfrom() does not take place until process_connection() hook > is invoked. This is consistent with apache code, I think. So, one would > think that vanilla httpd processes ( without my changes) encounter the > same > problem ?? After the mutex is turned off and before the read/recv is > performed > there is a window of opportunity when other process/processes will enter > select() > and it will immediately return a positive value, indicating the socket > to be > readable. One has to set the O_NDELAY flag in these descriptors to work > around > this problem. > > Comments ?? recvfrom() on your UDP socket is analogous to the accept() done on the apache listening socket in a couple of respects, one of which is locking requirements you want to allow only one select() pop for a given datagram (the mutex takes care of this) *AND* the thread for which select() popped must call recvfrom() before releasing the mutex; otherwise, as soon as you release the mutex select() can pop for another thread you can teach the code to recover if a thread is awakened and doesn't get a datagram, but performance will suffer due to extra dispatches -- Jeff Trawick | trawick@attglobal.net | PGP public key at web site: http://www.geocities.com/SiliconValley/Park/9289/ Born in Roswell... married an alien...