apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject Re: Pipe inheritance
Date Wed, 18 Jan 2006 19:39:44 GMT
Peter N. Lundblad wrote:
> On Wed, 18 Jan 2006, William A. Rowe, Jr. wrote:
> 
>>FYI this is one of the -race- conditions observed on httpd with cgi.  It's
>>quite possible on an event/worker threaded server that a second thread has
>>invoked apr_file_pipe_create, not flagged the server side as uninherited,
>>while the first thread is fork()ing for exec.  That other daemon on thread
>>one holds open both ends of the pipe forever, resulting in no EOF.
> 
> Ugh! Is there a way round this without serializing pipe creating/fork?

Well we could limit exposure by always opening resources in uninhereted mode,
the modifying our exec/fork code to walk an 'inherit this' list to make those
resources inherited, and then mark them uninherited again after we've done
the fork/exec.

> When I think about this, it seems like there is a race in every file open
> situation, since you can't install the cleanup handler before the file is
> opened. Or, you maybe can, but it doesn't happen in the current code. Or
> do I miss something now?

It sure needs to be revisited.

Mime
View raw message