Return-Path: Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 85131 invoked by uid 500); 4 May 2001 01:35:33 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 85119 invoked from network); 4 May 2001 01:35:33 -0000 X-Authentication-Warning: adsl-77-241-65.rdu.bellsouth.net: trawick set sender to trawickj@bellsouth.net using -f Sender: trawick@bellsouth.net To: dev@apr.apache.org Subject: Re: cvs commit: apr/network_io/unix sendrecv.c References: <20010503223802.28219.qmail@apache.org> <20010503162219.C899@waka.ebuilt.net> From: Jeff Trawick Date: 03 May 2001 21:31:34 -0400 In-Reply-To: <20010503162219.C899@waka.ebuilt.net> Message-ID: Lines: 45 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 "Roy T. Fielding" writes: > > Index: sendfile.c > > =================================================================== > > RCS file: /home/cvs/apr/test/sendfile.c,v > > retrieving revision 1.12 > > retrieving revision 1.13 > > diff -u -r1.12 -r1.13 > > --- sendfile.c 2001/03/31 22:37:13 1.12 > > +++ sendfile.c 2001/05/03 22:37:58 1.13 > > @@ -373,6 +373,7 @@ > > printf("apr_sendfile()->%d, sent %ld bytes\n", rv, (long)tmplen); > > if (rv) { > > if (APR_STATUS_IS_EAGAIN(rv)) { > > + assert(tmplen == 0); > > nsocks = 1; > > tmprv = apr_poll(pfd, &nsocks, -1); > > assert(!tmprv); > > No assert should ever be present in server code, period. I don't care if > the only way it could be triggered is by a cosmic ray hittng a memory cell > at just the wrong moment in time, it doesn't belong in the server > code. My first take was to suggest that you stop being excited about an assert() in a test program. But then I disagree 100% with your comments on assertions :) I practically always prefer that software go out with a bang rather than fail silently, even when I don't have time or don't want to complicate the logic by handling unanticipated conditions more carefully than with an assertion. When I used to work on mission critical code we had a fair number of asserts, usually added when they could be done so with little extra pathlength... They are infinitely more reliable than any comment and they also acknowledge the fact that shit happens and you need to figure out where things went south. I like that Apache has asserts that only work with AP_DEBUG builds as well as asserts that are always active. Some AP_DEBUG asserts added by Greg Ames and others have helped us get some nasty bugs out. -- Jeff Trawick | trawickj@bellsouth.net | PGP public key at web site: http://www.geocities.com/SiliconValley/Park/9289/ Born in Roswell... married an alien...