Created: (MODPYTHON-182) Memory leak in request readline()
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > Apache Mod-Python > Created: (MODPYTHON-182) Memory leak in request readline()




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Created: (MODPYTHON-182) Memory leak in request readline()  
Jim Gallacher (JIRA)


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-12-06 12:12 AM

Memory leak in request readline()
---------------------------------

Key: MODPYTHON-182
URL: http://issues.apache.org/jira/browse/MODPYTHON-182
Project: mod_python
Issue Type: Bug
Components: core
Affects Versions: 3.2.10, 3.3, 3.2.x
Environment: Apache 2.0.55 mpm-worker
Reporter: Jim Gallacher
Assigned To: Jim Gallacher


There is at least one memory leak request.readline(). I'm currently auditing
 the code so there may well be others.

I think the leak will only occur when the request body is incompletely read 
with readline, which is likely an unusual corner case. The following demostr
ates the leak:

Consider a request body consisting of:

'\n'.join([ 'a'*100 for i in xrange(0, 100) ])

and using this handler:


def handler(req):
# Handler reads 20 lines but request contains 100 lines.
# Since the body is not completely read, the buffer allocated
# in requestobject.c req_readline is never freed.
req.content_type = 'text/plain'
count = 0
for i in range(0, 20):
line = req.readline()
count += 1

req.write('ok readline_partial: %d lines read' % count)
return apache.OK

With this test setup I'm seeing a leak of approx 10k bytes per request.








[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 06:20 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register