httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bloom <>
Subject Re: mod_cgi and thread safety
Date Wed, 03 Feb 1999 13:53:41 GMT

You are really going about this wrong.  The chdir needs to be done after
the fork.  That is the key to this issue.  You told me yesterday that it
was being done after the fork, so mod_cgi should have been thread safe.
In this e-mail, you are saying that the threads are doing the chdir.
These are mutually exclusive statements.  When I fork a new processes to
run my cgi, I want to do my chdir.  That won't affect my server process.
I don't care about any threads in the newly forked process.  Those should
all be dead, except for the currently executing thread.  Once the chdir is
done, I execute my cgi, and return appropriately.

I have a hard time believing that the chdir is being done in the cgi
process in the current code.  I don't believe it is, because in mod_cgi,
we chdir at least twice.  Once before we exec and once after.  There is no
reason to chdir the second time if we are in the cgi's process, because it
is about to die, and why do we care where in the file tree it is when it
goes away?

I think we need to look at this code again, and determine where the chdir
is being done and where it should be being done.


On Wed, 3 Feb 1999, Michael H. Voase wrote:

> Gday,
>     I dont usually reply to me own threads but
> no one seems to have shot me down in flames
> yet ( which is unusual  ;-)
> As far as the chdir abstraction goes I segest
> creating a second a second API function for
> chdir using a thread safe method for functions
> calling chdir from within the treads and leaving
> the original ap_chdir_file abstraction
> for forking processes that dont run in thread
> space . BFIIK how to produce a working
> thread safe abstraction of chdir , considering
> that one will be delving deep into the roots of
> unix architecture to pull off a stunt like this .
> As such this is outside the scope of my
> humble capabilities ...
> ( maybe worth nagging the thread
> implementors about ??? )
> Cheers MikVoase.
> --
> ----------------------------------------------------------------------------
>  /~\     /~\            CASTLE INDUSTRIES PTY. LTD.
>  | |_____| |            Incorporated 1969. in N.S.W., Australia
>  |         |            Phone +612 6562 1345 Fax +612 6567 1449
>  |   /~\   |            Web
>  |   [ ]   |            Michael H. Voase.  Director.
> ~~~~~~~~~~~~~~          Cause Linux Flies and Windoze Dies ... 'nuf said.
> ----------------------------------------------------------------------------

Ryan Bloom
4205 S Miami Blvd	
RTP, NC 27709		It's a beautiful sight to see good dancers 
			doing simple steps.  It's a painful sight to
			see beginners doing complicated patterns.	

View raw message