Apache Mod-Python - 3.2.8 - Memory leaks with util.FieldStorage

This is Interesting: Free IT Magazines  
Home > Archive > Apache Mod-Python > June 2006 > 3.2.8 - Memory leaks with util.FieldStorage





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author 3.2.8 - Memory leaks with util.FieldStorage
Laurent Blanquet

2006-06-10, 1:11 pm

Hello,

I'm using MOD_APACHE 3.2.8 (from binary dist). with Apache 2.0.55 under Windows XP Pro.
I encounter memory leaks (~ 16 Ko per request) with a very basic handler like :

import mod_python
from mod_python import util

def handler(req):
F=util.FieldStorage( req )
return mod_python.apache.OK

And sending an HTTP request like :

==== Output from TCPWATCH ====
POST http://localhost:80/python/Alertes.py HTTP/1.0
Content-Type: multipart/form-data; boundary=--------061006144341906
Content-Length: 209
Proxy-Connection: keep-alive
Host: www.tx2-localhost
Accept: text/html, */*
User-Agent: Mozilla/3.0 (compatible; Indy Library)
Proxy-Authorization: Basic Og==

----------061006144341906
Content-Disposition: form-data; name="TYPE"

LAST_ALERTS
----------061006144341906
Content-Disposition: form-data; name="FILEAGE"

180

----------061006144341906--
====

Has somebody encountered the same problem ?
Is there a turn-around or a fix that can be forecasted ?

Best regards, Laurent.
Jim Gallacher

2006-06-10, 7:12 pm

Laurent Blanquet wrote:
> Hello,
>
> I'm using MOD_APACHE 3.2.8 (from binary dist). with Apache 2.0.55 under Windows XP Pro.
> I encounter memory leaks (~ 16 Ko per request) with a very basic handler like :
>
> import mod_python
> from mod_python import util
>
> def handler(req):
> F=util.FieldStorage( req )
> return mod_python.apache.OK
>
> And sending an HTTP request like :
>
> ==== Output from TCPWATCH ====
> POST http://localhost:80/python/Alertes.py HTTP/1.0
> Content-Type: multipart/form-data; boundary=--------061006144341906
> Content-Length: 209
> Proxy-Connection: keep-alive
> Host: www.tx2-localhost
> Accept: text/html, */*
> User-Agent: Mozilla/3.0 (compatible; Indy Library)
> Proxy-Authorization: Basic Og==
>
> ----------061006144341906
> Content-Disposition: form-data; name="TYPE"
>
> LAST_ALERTS
> ----------061006144341906
> Content-Disposition: form-data; name="FILEAGE"
>
> 180
>
> ----------061006144341906--
> ====
>
> Has somebody encountered the same problem ?
> Is there a turn-around or a fix that can be forecasted ?


This is the first that this has been reported, so forecasting a fix is
difficult. It would be helpful if you created a JIRA issue at
http://issues.apache.org/jira/browse/MODPYTHON

util.FieldStorage is straight Python code, so I'm surprised that it
would be leaking, particularly 16K per request. Can you offer any more
details? How are you testing, other mod_python Apache directives you may
be using an so on.

It's probably best to keep this discussion on the developer's list so
that the thread doesn't get muddled.

Jim

Jim Gallacher

2006-06-10, 7:12 pm

Jim Gallacher wrote:
> Laurent Blanquet wrote:
>
> This is the first that this has been reported, so forecasting a fix is
> difficult. It would be helpful if you created a JIRA issue at
> http://issues.apache.org/jira/browse/MODPYTHON
>
> util.FieldStorage is straight Python code, so I'm surprised that it
> would be leaking, particularly 16K per request. Can you offer any more
> details? How are you testing, other mod_python Apache directives you may
> be using an so on.


Laurent,

Also, could you confirm that it *is* FieldStorage that is leaking (if
you haven't already) by just reading the request body, bypassing
FieldStorage completely. eg.

import mod_python
from mod_python import util

def handler(req):
data = req.read()
return mod_python.apache.OK

Thanks,
Jim

Jim Gallacher

2006-06-10, 7:12 pm

Jim Gallacher wrote:
> Laurent Blanquet wrote:
[vbcol=seagreen]
>
> This is the first that this has been reported, so forecasting a fix is
> difficult. It would be helpful if you created a JIRA issue at
> http://issues.apache.org/jira/browse/MODPYTHON
>
> util.FieldStorage is straight Python code, so I'm surprised that it
> would be leaking, particularly 16K per request.


That was a stupid statement on my part since FieldStorage does call some
mod_python code that *is* written in C, and could very well leak. It is
however correct to say that we have not had a leak reported against
FieldStorage in particular. There were some leaks in 3.1.4, but I
thought we caught them for the 3.2.7 release.

Back to the code.

Jim

Jim Gallacher

2006-06-11, 7:11 pm

Laurent,

Could you run a couple of more tests?

test1.py
--------
from mod_python import apache, util

def handler(req):
pqs = util.parse_qsl('foo=a&bar=b')
req.content_type = 'text/plain'
req.write('mod_python.util.parse_qsl')
return apache.OK

test2.py
--------
from mod_python import apache
import cgi

def handler(req):
pqs = cgi.parse_qsl('foo=a&bar=b')
req.content_type = 'text/plain'
req.write('cgi.parse_qsl')
return apache.OK


Jim


Laurent Blanquet

2006-06-12, 1:12 am

Hello,

I've run the 2 tests, and I do not see any leaks.

Laurent.

> Laurent,
>
> Could you run a couple of more tests?
>
> test1.py
> --------
> from mod_python import apache, util
>
> def handler(req):
> pqs = util.parse_qsl('foo=a&bar=b')
> req.content_type = 'text/plain'
> req.write('mod_python.util.parse_qsl')
> return apache.OK
>
> test2.py
> --------
> from mod_python import apache
> import cgi
>
> def handler(req):
> pqs = cgi.parse_qsl('foo=a&bar=b')
> req.content_type = 'text/plain'
> req.write('cgi.parse_qsl')
> return apache.OK
>
>
> Jim



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com