[mod_python] Leaking and cgi-handler

Sean True seant at alum.mit.edu
Mon Jun 5 07:21:48 EST 2000


Like too many people, I'm working on a version of python server pages -- 
.phtml pages which contain
mixed python and HTML code, allowing on the fly construction of pages from 
files which can mostly be
edited with a WYSIWYG HTML editor. I have a phtml.py program which is 
invoked as a cgi script, and more
recently under cgi-handler.

The documentation for cgi-handler notes that it may be subject to a memory 
leak related to os.environ().

On a Linux Redhat 6.1 system with Apache and statically linked mod_python, 
I'm seeing memory usage growing
by about 10K or so per page served (measured by watching the system monitor 
reports grow). Performance also
drops -- from about 15 pages served per second to less than 8 pages per second.

All of this makes me think that some data structure in the interpreter or 
mod_python is growing without bound,
in combination with a linear search from the front of the list.

The same code runs under pyapache with a very modest memory leak (also 
documented for pyapache) of about 1K
per page served.

I was a little unwilling to try switching to a more direct method of 
content handling under mod_python (creating
a request handler for .phtml page) until the whole system was a little more 
stable. I'm in production under pyapache
now, and I hate forking the code base.

Comments? Suggestions?

Does anyone have a skeleton content handler they would be willing to share, 
along with a corresponding .conf
entry?

-- Sean

==========
Sean True
seant at alum.mit.edu




More information about the Mod_python mailing list