You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-dev@quetz.apache.org by "Jim Gallacher (JIRA)" <ji...@apache.org> on 2005/06/23 16:23:11 UTC

[jira] Created: (MODPYTHON-60) PythonOption directive causes memory leak

PythonOption directive causes memory leak
-----------------------------------------

         Key: MODPYTHON-60
         URL: http://issues.apache.org/jira/browse/MODPYTHON-60
     Project: mod_python
        Type: Bug
  Components: core  
    Versions: 3.1.4, 3.1.3, 3.2.0    
 Environment: Linux
    Reporter: Jim Gallacher
    Priority: Critical


This was previously reported on the mod_python mailing list. See http://www.modpython.org/pipermail/mod_python/2004-April/015395.html

A memory leak results when there is a PythonOption directive in the apache config file. Leak occurs when PythonOption is in either <VirtualHost>  or <Directory> section.

For each request, approx 25 bytes of memory is leaked per PythonOption directive.

Methodolgy (using top to gauge memory usage, 100,000 requests per test case):

def handler(req):
    req.content_type = 'text/plain'
    req.write('PythonOption test\n')
    return apache.OK

1. No PythonOption directives:
    1.4 % MEM

2. 50 PythonOption directives:
    11.3% MEM     

3. 100 PythonOption directives:
     25.4 % MEM


I know 50 or 100 PythonOptions is not likely in a production system, but it clearly demonstrate the leak.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Re: [jira] Created: (MODPYTHON-60) PythonOption directive causes memory leak

Posted by Nicolas Lehuen <ni...@gmail.com>.
OK, anything allocated to a pool is automatically deallocated by the
pool when it is cleared, which should be at the end of a request :

http://www.apachetutor.org/dev/pools

So if there is a memory leak, it should not be caused by something
allocated to a pool.

Regards,
Nicolas

2005/6/24, Nicolas Lehuen <ni...@gmail.com>:
> It looks like that's the way to do it :
> 
> http://modules.apache.org/doc/API.html#per-dir
> http://www.apachetutor.org/dev/config
> 
> But the memory management seems very mysterious to me here... I can't
> find anything that looks like a destructor for the py_config structure
> !
> 
> Regards,
> Nicolas
> 
> 2005/6/24, Jim Gallacher <jg...@sympatico.ca>:
> > Anybody had a chance to look at this yet?
> >
> > I'm kind of suspicous of python_merge_config in mod_python.c. It gets
> > called once for every request, and calls apr_pcalloc which I assume
> > allocates some memory from the pool.
> >
> >      py_config *merged_conf =
> >          (py_config *) apr_pcalloc(p, sizeof(py_config));
> >
> > I don't see where or how this memory gets freed. I've taken a look at
> > the apache src code but get lost pretty quick.
> >
> > Regards,
> > Jim
> >
> >
> > Jim Gallacher (JIRA) wrote:
> > > PythonOption directive causes memory leak
> > > -----------------------------------------
> > >
> > >          Key: MODPYTHON-60
> > >          URL: http://issues.apache.org/jira/browse/MODPYTHON-60
> > >      Project: mod_python
> > >         Type: Bug
> > >   Components: core
> > >     Versions: 3.1.4, 3.1.3, 3.2.0
> > >  Environment: Linux
> > >     Reporter: Jim Gallacher
> > >     Priority: Critical
> > >
> > >
> > > This was previously reported on the mod_python mailing list. See http://www.modpython.org/pipermail/mod_python/2004-April/015395.html
> > >
> > > A memory leak results when there is a PythonOption directive in the apache config file. Leak occurs when PythonOption is in either <VirtualHost>  or <Directory> section.
> > >
> > > For each request, approx 25 bytes of memory is leaked per PythonOption directive.
> > >
> > > Methodolgy (using top to gauge memory usage, 100,000 requests per test case):
> > >
> > > def handler(req):
> > >     req.content_type = 'text/plain'
> > >     req.write('PythonOption test\n')
> > >     return apache.OK
> > >
> > > 1. No PythonOption directives:
> > >     1.4 % MEM
> > >
> > > 2. 50 PythonOption directives:
> > >     11.3% MEM
> > >
> > > 3. 100 PythonOption directives:
> > >      25.4 % MEM
> > >
> > >
> > > I know 50 or 100 PythonOptions is not likely in a production system, but it clearly demonstrate the leak.
> > >
> > >
> > >
> >
> >
>

Re: [jira] Created: (MODPYTHON-60) PythonOption directive causes memory leak

Posted by Nicolas Lehuen <ni...@gmail.com>.
It looks like that's the way to do it :

http://modules.apache.org/doc/API.html#per-dir
http://www.apachetutor.org/dev/config

But the memory management seems very mysterious to me here... I can't
find anything that looks like a destructor for the py_config structure
!

Regards,
Nicolas

2005/6/24, Jim Gallacher <jg...@sympatico.ca>:
> Anybody had a chance to look at this yet?
> 
> I'm kind of suspicous of python_merge_config in mod_python.c. It gets
> called once for every request, and calls apr_pcalloc which I assume
> allocates some memory from the pool.
> 
>      py_config *merged_conf =
>          (py_config *) apr_pcalloc(p, sizeof(py_config));
> 
> I don't see where or how this memory gets freed. I've taken a look at
> the apache src code but get lost pretty quick.
> 
> Regards,
> Jim
> 
> 
> Jim Gallacher (JIRA) wrote:
> > PythonOption directive causes memory leak
> > -----------------------------------------
> >
> >          Key: MODPYTHON-60
> >          URL: http://issues.apache.org/jira/browse/MODPYTHON-60
> >      Project: mod_python
> >         Type: Bug
> >   Components: core
> >     Versions: 3.1.4, 3.1.3, 3.2.0
> >  Environment: Linux
> >     Reporter: Jim Gallacher
> >     Priority: Critical
> >
> >
> > This was previously reported on the mod_python mailing list. See http://www.modpython.org/pipermail/mod_python/2004-April/015395.html
> >
> > A memory leak results when there is a PythonOption directive in the apache config file. Leak occurs when PythonOption is in either <VirtualHost>  or <Directory> section.
> >
> > For each request, approx 25 bytes of memory is leaked per PythonOption directive.
> >
> > Methodolgy (using top to gauge memory usage, 100,000 requests per test case):
> >
> > def handler(req):
> >     req.content_type = 'text/plain'
> >     req.write('PythonOption test\n')
> >     return apache.OK
> >
> > 1. No PythonOption directives:
> >     1.4 % MEM
> >
> > 2. 50 PythonOption directives:
> >     11.3% MEM
> >
> > 3. 100 PythonOption directives:
> >      25.4 % MEM
> >
> >
> > I know 50 or 100 PythonOptions is not likely in a production system, but it clearly demonstrate the leak.
> >
> >
> >
> 
>

Re: [jira] Created: (MODPYTHON-60) PythonOption directive causes memory leak

Posted by Jim Gallacher <jg...@sympatico.ca>.
Anybody had a chance to look at this yet?

I'm kind of suspicous of python_merge_config in mod_python.c. It gets 
called once for every request, and calls apr_pcalloc which I assume 
allocates some memory from the pool.

     py_config *merged_conf =
         (py_config *) apr_pcalloc(p, sizeof(py_config));


I don't see where or how this memory gets freed. I've taken a look at 
the apache src code but get lost pretty quick.

Regards,
Jim


Jim Gallacher (JIRA) wrote:
> PythonOption directive causes memory leak
> -----------------------------------------
> 
>          Key: MODPYTHON-60
>          URL: http://issues.apache.org/jira/browse/MODPYTHON-60
>      Project: mod_python
>         Type: Bug
>   Components: core  
>     Versions: 3.1.4, 3.1.3, 3.2.0    
>  Environment: Linux
>     Reporter: Jim Gallacher
>     Priority: Critical
> 
> 
> This was previously reported on the mod_python mailing list. See http://www.modpython.org/pipermail/mod_python/2004-April/015395.html
> 
> A memory leak results when there is a PythonOption directive in the apache config file. Leak occurs when PythonOption is in either <VirtualHost>  or <Directory> section.
> 
> For each request, approx 25 bytes of memory is leaked per PythonOption directive.
> 
> Methodolgy (using top to gauge memory usage, 100,000 requests per test case):
> 
> def handler(req):
>     req.content_type = 'text/plain'
>     req.write('PythonOption test\n')
>     return apache.OK
> 
> 1. No PythonOption directives:
>     1.4 % MEM
> 
> 2. 50 PythonOption directives:
>     11.3% MEM     
> 
> 3. 100 PythonOption directives:
>      25.4 % MEM
> 
> 
> I know 50 or 100 PythonOptions is not likely in a production system, but it clearly demonstrate the leak.
> 
> 
> 


[jira] Resolved: (MODPYTHON-60) PythonOption directive causes memory leak

Posted by "Jim Gallacher (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/MODPYTHON-60?page=all ]
     
Jim Gallacher resolved MODPYTHON-60:
------------------------------------

    Fix Version: 3.2.0
                 3.3.0
     Resolution: Fixed
      Assign To: Jim Gallacher

> PythonOption directive causes memory leak
> -----------------------------------------
>
>          Key: MODPYTHON-60
>          URL: http://issues.apache.org/jira/browse/MODPYTHON-60
>      Project: mod_python
>         Type: Bug
>   Components: core
>     Versions: 3.1.4, 3.1.3, 3.2.0
>  Environment: Linux
>     Reporter: Jim Gallacher
>     Assignee: Jim Gallacher
>     Priority: Critical
>      Fix For: 3.3.0, 3.2.0

>
> This was previously reported on the mod_python mailing list. See http://www.modpython.org/pipermail/mod_python/2004-April/015395.html
> A memory leak results when there is a PythonOption directive in the apache config file. Leak occurs when PythonOption is in either <VirtualHost>  or <Directory> section.
> For each request, approx 25 bytes of memory is leaked per PythonOption directive.
> Methodolgy (using top to gauge memory usage, 100,000 requests per test case):
> def handler(req):
>     req.content_type = 'text/plain'
>     req.write('PythonOption test\n')
>     return apache.OK
> 1. No PythonOption directives:
>     1.4 % MEM
> 2. 50 PythonOption directives:
>     11.3% MEM     
> 3. 100 PythonOption directives:
>      25.4 % MEM
> I know 50 or 100 PythonOptions is not likely in a production system, but it clearly demonstrate the leak.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (MODPYTHON-60) PythonOption directive causes memory leak

Posted by "Nicolas Lehuen (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/MODPYTHON-60?page=all ]

Nicolas Lehuen updated MODPYTHON-60:
------------------------------------

    Fix Version:     (was: 3.3.0)

> PythonOption directive causes memory leak
> -----------------------------------------
>
>          Key: MODPYTHON-60
>          URL: http://issues.apache.org/jira/browse/MODPYTHON-60
>      Project: mod_python
>         Type: Bug
>   Components: core
>     Versions: 3.1.4, 3.1.3, 3.2.0
>  Environment: Linux
>     Reporter: Jim Gallacher
>     Assignee: Jim Gallacher
>     Priority: Critical
>      Fix For: 3.2.0

>
> This was previously reported on the mod_python mailing list. See http://www.modpython.org/pipermail/mod_python/2004-April/015395.html
> A memory leak results when there is a PythonOption directive in the apache config file. Leak occurs when PythonOption is in either <VirtualHost>  or <Directory> section.
> For each request, approx 25 bytes of memory is leaked per PythonOption directive.
> Methodolgy (using top to gauge memory usage, 100,000 requests per test case):
> def handler(req):
>     req.content_type = 'text/plain'
>     req.write('PythonOption test\n')
>     return apache.OK
> 1. No PythonOption directives:
>     1.4 % MEM
> 2. 50 PythonOption directives:
>     11.3% MEM     
> 3. 100 PythonOption directives:
>      25.4 % MEM
> I know 50 or 100 PythonOptions is not likely in a production system, but it clearly demonstrate the leak.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (MODPYTHON-60) PythonOption directive causes memory leak

Posted by "Graham Dumpleton (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/MODPYTHON-60?page=all ]
     
Graham Dumpleton closed MODPYTHON-60:
-------------------------------------


> PythonOption directive causes memory leak
> -----------------------------------------
>
>          Key: MODPYTHON-60
>          URL: http://issues.apache.org/jira/browse/MODPYTHON-60
>      Project: mod_python
>         Type: Bug
>   Components: core
>     Versions: 3.1.4, 3.1.3, 3.2.7
>  Environment: Linux
>     Reporter: Jim Gallacher
>     Assignee: Jim Gallacher
>     Priority: Critical
>      Fix For: 3.2.7

>
> This was previously reported on the mod_python mailing list. See http://www.modpython.org/pipermail/mod_python/2004-April/015395.html
> A memory leak results when there is a PythonOption directive in the apache config file. Leak occurs when PythonOption is in either <VirtualHost>  or <Directory> section.
> For each request, approx 25 bytes of memory is leaked per PythonOption directive.
> Methodolgy (using top to gauge memory usage, 100,000 requests per test case):
> def handler(req):
>     req.content_type = 'text/plain'
>     req.write('PythonOption test\n')
>     return apache.OK
> 1. No PythonOption directives:
>     1.4 % MEM
> 2. 50 PythonOption directives:
>     11.3% MEM     
> 3. 100 PythonOption directives:
>      25.4 % MEM
> I know 50 or 100 PythonOptions is not likely in a production system, but it clearly demonstrate the leak.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira