| Chris Hagner 
    CHagner at fool.com Wed May 9 18:51:25 EST 2001 
 I'm seeing some strange things with modules being reloaded when used in
mod_python.
Here's the scenario...
1. I'm using PythonImport to import a module (called MyConfig) and store it
in a module variable.
2. That module variable is being accessed by the registered modpy handler.
3. When I start up apache, MyConfig is imported once for each child process.
4. When I request a page, the handler accesses MyConfig... here's the weird
part.
5. SOMETIMES, it re-runs/imports the module containing MyConfig....
specifically, the first couple requests (6? I have 5 child procs running)
re-import the module and then it stops re-importing... for a while... then,
every once in a while it re-imports MyConfig.
Can some explain this?
Is apache killing off child procs and therefore requiring new python
subinterpreters to start up?  If this is not the case, I'm looking for a way
to keep an object in memory (thus, not have its module re-imported).
Here's my modpy setup if it helps...
        SetHandler python-program
        PythonHandler monty.modpy_handler
        PythonImport demo.MyConfig
        PythonDebug On
        PythonNoReload On
        PythonInterpPerDirectory Off
Thanks in advance...
Chris
 |