[mod_python] severe memory leak problem with mod_python

Manjeet Chaudhary manjeet at infogridpacific.com
Thu Jul 7 04:55:42 EDT 2005


Hi Guys

We are facing memory leak problem; most probably due to mod_python.
Our application is web-based application using below mentioned Apache 
server version including mod-python. We are using Publisher Handler in 
mod-python.
We are facing a severe memory leak problem [ memory is used and never 
being freed , it is freed only when we stop apache server (httpd) or 
restart it]. We are using dbxml(2.1.8) as our backend database. Our 
program (python module) in cgi-bin dir is processing the url request. 
The module is accessing the document from the dbxml container through 
Simple - XML -RPC communication and returning to the browser. As the no. 
of requests increases memory is used up [never freed again] and the 
server crashes [CentOS automatically kill the process], but if we stop 
or restart httpd the memory is released in huge amount . There were 
similar problems in dbxml version 2.0.9 , but those were solved when we 
upgraded it to version 2.1.8.

I have already updated my kernel, mod_python, dbxml.
I used Valgrind to check memory leak. But in summary report it is not 
showing any type of memory leak.

I also read that is there is some problem with Python and it's memory 
management. ( http://evanjones.ca/python-memory.html ). Is this a 
problem due to Python's memory management. But our other 
application/servers are working fine.

It seems that apache/mod_python process is leaking memory.
This is a serious problem and so we need a solution for it.

Please help me out for solving this problem.
Maybe somebody here has any idea what is going on.

Thank you in advance and all the best,
Manjeet Chaudhary

Summary:
-----------------------------------------------------------
.................
Hardware/Softwares and OS we are using :-
Pentium4 machine with 1GB DDR-RAM.
CentOS 4.0 - kernel 2.6.9-11-EL. Upgraded from 2.6.9-3
Dbxml - 2.1.8 upgraded from 2.0.9
Mod_Python - 3.1.4 with Patches
Python - 2.3.4.
HTTPD server - Apache/2.0.52
Pybsdbd - bsddb3-4.3.3
.................
Httpd Configurations: (mod_python specific. We are using .htaccess in 
cgi-bin directory )

<Directory "/var/www/cgi-bin">
AllowOverride FileInfo
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>
.................
.htaccess file:

AddHandler mod_python .py
SetHandler mod_python
PythonHandler mod_python.publisher
PythonDebug On
.................
Remedies i applied:
1. Updated Kernel from 2.6.9-3 to 2.6.9-11.EL as suggested in 
http://lists.centos.org/pipermail/centos/2005-June/007113.html
2. Updated DbXml from 2.0.9 to 2.1.8 as suggested in
http://www.sleepycat.com/xml_update/2.1.8/if.2.1.8.html
3. Reinstalled mod_python with patches as mentioned in
http://www.dscpl.com.au/projects/vampire/patches.html


More information about the Mod_python mailing list