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 18:56:02 GMT
> + * @remark The returned file descriptors will be inherited by child processes.
> + * This can be changed using apr_file_inherit_unset().
>   */
>  APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, 
>                                                 apr_file_t **out,

Suppose we should further observe that it's strongly recommended that only
one side of a given pipe should remain inherited, and the server's side of
all pipes should be immediately apr_file_inherit_unset() upon creation?

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.


View raw message