httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <>
Subject Re: note_cleanups_for_buff vs. note_cleanups_for_fd
Date Fri, 15 Aug 1997 21:33:16 GMT
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

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.) 


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

View raw message