[mod_python] Re: Another threading issue: chdir (fwd)

Greg Stein gstein at lyra.org
Mon Jun 12 14:18:20 EST 2000


On Mon, Jun 12, 2000 at 11:06:03PM +0200, Stéphane Bidoul wrote:
> >The more I think about this, the more it seems to me that doing away with
> >the chdir and prepending the path rather than the '.' is the way to go.
> 
> Agreed, but I wonder how much the manipulation of sys.path to do the imports
> can cause threading issues... Is it possible to avoid it?

sys.path is specific to an interpreter, rather than to a thread. Therefore,
threads should not be changing it.

> >This will break old code that relied on the chdir being there, but what
> >can you do...
> >All the other solutions will make threaded mod_python incompatible with
> >nonthreaded be it extra directives or different code that you need....
> 
> Cross platform compatibility is indeed important. To achive it people
> should be told to assume multi-threaded operation: to be portable
> to windows, and also to be Apache2-proof [since I understand that
> it will use threads on Unix also;

Correct. Apache 2.0 is threaded whenever threads are available (basically
everywhere nowadays). You can still run Apache 2.0 in its current mode, but
the default is threaded.

> but it may not be a target for mod_python,
> I don't know how different the API is].

The API is different enough; a 1.3 module can be ported, but it would be
reasonably difficult to have a module be compileable for both.

There are a number of other things that can be taken advantage of in the
Apache 2.0 API to improve/tighten the Apache/Python binding. I've been
planning to implement an Apache 2.0 specific "mod_py2" this summer to take
advantage of the 2.0 benefits. (as an Apache author, I can also make changes
to Apache to enhance this even further :-) In conjunction with that work,
I'm going to redo my "free threading patches" for 1.6 so that Python can
operate completely threaded within Apache 2.0 (e.g. the central lock
disappears entirely).

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/



More information about the Mod_python mailing list