quetz-mod_python-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexis Marrero <amarr...@mitre.org>
Subject Re: memory leak in request.readline()
Date Thu, 10 Aug 2006 20:09:46 GMT
I'm using Apache 2.0.54.

In my test is leaking exactly 8 bytes per request.


/amn

On Aug 10, 2006, at 2:49 PM, Jim Gallacher wrote:

> Alexis Marrero wrote:
>> All,
>>
>> We are trying to nail down a memory leak that happens only when
>> documents are POSTed to the server.
>>
>> For testing we have a short script that does:
>>
>> while True:
>>     dictionary_of_parameters = {'field1': 'a'*100000}
>>     post('url...', dictionary_of_parameters)
>>
>> Then we run "top" on the server and watch the server memory grow  
>> without
>> bound.  Why do we know that the problem is in request.readline()?   
>> If I
>> go to mod_python.util.FieldStorage.read_to_boundary() and add the
>> following statement:
>>
>> def read_to_boundary(...):
>>   return True
>>   ...
>>
>> as the first executable line in the function the memory does not  
>> grow.
>>
>> I have read the req_readline a 1000 time and I can't figure out where
>> the problem is.
>>
>>
>> My config:
>> Python 2.4.1
>> mod_python 3.2.10
>>
>> Our request handler does nothing other than using util.FieldStorage 
>> (req)
>> and req.write('hello').
>>
>> I have some suspicion that it has to do with:
>> ....
>>     19   * requestobject.c
>>     20   *
>>     21   * $Id: requestobject.c 420297 2006-07-09 13:53:06Z nlehuen $
>>     22   *
>>     23   */
>> ....
>>    846      /* Free rbuff if we're done with it */
>>    847      if (self->rbuff_pos >= self->rbuff_len && self->rbuff
! 
>> = NULL)
>>    848      {
>>    849          free(self->rbuff);
>>    850          self->rbuff = NULL;
>>    851      }
>>    852
>>
>> Though, I can't confirm.
>>
>>
>> /amn
>
> When we were fixing MODPYTHON-172 I was a little suspicious of that  
> bit
> of code as
>
>
> When we were fixing MODPYTHON-172 I was a little suspicious of that  
> bit
> of code as well, but I couldn't see exactly where it might be going
> wrong, and in the end the leak hunt led elsewhere.
>
> How fast are you leaking memory with your test script? Which Apache  
> mpm
> are you using?
>
> Jim
>
>


Mime
View raw message