[mod_python] Strange reloading of modules used in handler

Damjan gdamjan at mail.net.mk
Thu May 10 04:16:05 EST 2001

On Wed, May 09, 2001 at 06:51:25PM -0400, Chris Hagner wrote:
> 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.

I'm not very sure the PythonImport directive works too good, and anyway there's
no need to use it. Just use plain import in the Python scripts.

> 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.

Apache child process die sometimes, either deliberately either not. This causes
your module to be re-imported.

Damjan Georgievski		|           Дамјан Георгиевски
Skopje, Macedonia		|           Скопје, Македонија

More information about the Mod_python mailing list