Received: (from majordom@localhost) by hyperreal.org (8.8.5/8.8.5) id OAA10905; Fri, 15 Aug 1997 14:44:27 -0700 (PDT) Received: from twinlark.arctic.org (twinlark.arctic.org [204.62.130.91]) by hyperreal.org (8.8.5/8.8.5) with SMTP id OAA10900 for ; Fri, 15 Aug 1997 14:44:24 -0700 (PDT) Received: (qmail 18419 invoked by uid 500); 15 Aug 1997 21:33:16 -0000 Date: Fri, 15 Aug 1997 14:33:16 -0700 (PDT) From: Dean Gaudet To: sameer cc: stronghold-dev@c2.net, new-httpd@hyperreal.org Subject: Re: note_cleanups_for_buff vs. note_cleanups_for_fd In-Reply-To: <199708152003.NAA00629@gabber.c2.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org I actually babbled about this a bit. The question I posed to the list was "why aren't we bflushing on a buff cleanup?" Ben asked why would we want to do that and my comment was that "well, fclose() does that, and we clean that up properly, now that we're using buffs for CGIs we might run into troubles". I did change bclose() to use pclose()/pclosesocket(), and in the process did some serious race condition cleanup on the proxy (the other big BUFF user). It is theoretically possible to do a proper buff cleanup routine now ... but it has to be done during bpushfd() and you'll have to kill cleanups (sock or fd) because the callers are all written to register cleanups for the fds they pass in. It's a bit of a mess. The proper solution, imho, is to have hierarchical cleanups. Then a BUFF cleanup could exist which only does a bflush(), because you could dicate that the buff cleanup run before the fd/sock cleanup. In this case the caller still uses popenf or psocket to get the fds for a BUFF, and does a bpushfd on them. But it doesn't have to dink around registering/unregistering the cleanups for the fd. I can imagine cases where you want the bflush() to happen but you don't want the socket to be closed. The alloc.c cleanup code already works the way we need -- cleanups are run in LIFO order. But this is not documented as a feature of the API. This still isn't perfect, but might be good enough. (Consider the case: psocket(), bcreate(), bpushfd(), then the dufus does a kill_cleanups on the socket, and registers cleanups again ... for what reason I can't imagine, but it's still a possibility.) Dean On Fri, 15 Aug 1997, sameer wrote: > Since Dean integrated the C2 unbuffered CGI stuff, he fixed it > because the spawn_child_err_buff function wasn't calling > note_cleanups. I am now looking at this code and wondering why you're > calling note_cleanups_for_fd rather than creating a new > note_cleanups_for_buff -- shouldn't there be a few more things done to > clean up a buff than to clean up a plain fd? > > -- > Sameer Parekh Voice: 510-986-8770 > President FAX: 510-986-8777 > C2Net > http://www.c2.net/ sameer@c2.net >