[mod_python] Strange reloading of modules used in handler

Chris Hagner CHagner at fool.com
Wed May 9 23:57:32 EST 2001

Thanks, yeah, simply importing the module was my backup plan.  

My motivation is thus: the server running this handler/code is going to be
swamped load-wise and I wanted to be able to use apache's graceful restart
(starting new child procs and swapping them in for the old ones without
dropping a single request) to seamlessly update the application

Maybe I'm just being paranoid and the import won't make a graceful restart
drop a connection... I'll be doing some testing to find out just where this

Again, thanks for the feedback/input.  Much appreciated.


-----Original Message-----
From: Damjan [mailto:gdamjan at mail.net.mk]
Sent: Wednesday, May 09, 2001 10:16 PM
To: mod_python at modpython.org
Subject: Re: [mod_python] Strange reloading of modules used in handler

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
> in a module variable.

I'm not very sure the PythonImport directive works too good, and anyway
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
> 4. When I request a page, the handler accesses MyConfig... here's the
> 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...
> every once in a while it re-imports MyConfig.

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

Damjan Georgievski		|           Дамјан Георгиевски
Skopje, Macedonia		|           Скопје, Македонија
Mod_python mailing list
Mod_python at modpython.org

More information about the Mod_python mailing list