[mod_python] module caching problem

Huzaifa Tapal huzaifa at hostway.com
Tue Nov 23 19:43:26 EST 2004

How can I check if I am running a forked apache or a threaded apache.  Also
when you say "PythonReload is off" did you mean the PythonAutoReload
configuration directive in the mod_python handler declaration?





From: Scott Sanders [mailto:sanders at apache.org] 
Sent: Tuesday, November 23, 2004 6:12 PM
To: Huzaifa Tapal
Cc: mod_python at modpython.org
Subject: Re: [mod_python] module caching problem


If you are running a forked apache, the module has to be imported once per
process. If threaded, should only be imported once. Also make sure that
PythonReload is off.


On Nov 23, 2004, at 3:57 PM, Huzaifa Tapal wrote:

I am running into a problem with mod_python in that, I am importing a module
in the handler which creates a singleton in memory.  I am using the module
to hold cache information for any other modules that import the same module.


I started testing the cache mechanism when I noticed that the module was
being imported multiple times and not just once after the first request
after apache had started.  To test this, I put a few lines of code in the
module to write to a file the time it was last imported.  I noticed that
after restarting apache, the first time it writes to the file.  If I hit
refresh on my page immediately, multiple times, it doesn't write.  If I wait
like 10 seconds or more and then hit refresh again, it reimports that module
that should have been cached.


Also, If I make a request for a page from two different clients, it
reimports the module from each client.  Am I mistaken in thinking that any
module imported in the handler then is cached in mod_python's module cache
and subsequent imports of that module then are simply served up from the
cache.  Under what conditions then would the same module get reimported if
no modifications were made to that module?


Any help would be appreciated.


Mod_python mailing list
Mod_python at modpython.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20041123/e1ee7e51/attachment.html

More information about the Mod_python mailing list