[mod_python] Another threading issue: chdir (fwd)

Gregory Trubetskoy grisha at modpython.org
Thu Jun 8 18:14:05 EST 2000


Having the url directory as your current directory is just an intuitive
thing and makes it easier for the developer.... E.g. if you're trying to
open files, etc.

One thing that we could do is restore the original directory and make sure
that the lock is aqcuired before first chdir() and after the last chdir()?

Or chdir could be made optional via a directive of some sort.... I need to
think about this too...

--
  Gregory (Grisha) Trubetskoy
       grisha at modpython.org

On Thu, 8 Jun 2000, [Windows-1252] Stéphane Bidoul wrote:

> Hi again,
> 
> Obviously, chdir is not thread-safe
> (I discovered the problem by running different 
> handlers in different directories)
> 
> It's ok with the one performed in cgihandler,
> since cgi must run single-threaded anyway.
> 
> I wonder if the one in mod_python.c is really necessary?
> Maybe apache.import_module() could add the directory to
> pythonpath before doing the import instead of adding '.'.
> Oh, and now that I write it, changing python path is 
> not thread-safe either: can we do the import without
> changing pythonpath at all? If not, another lock 
> will be required to protect that...
> 
> There is also a chdir in the httpdapi handler
> but I've no idea about that one.
> 
> Well, I hope the end of the threading tunnel is in sight...
> 
> -sbi
> 





More information about the Mod_python mailing list