Closed: (MODPYTHON-181) Memory leak when using handlers in
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 > Closed: (MODPYTHON-181) Memory leak when using handlers in




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

    Closed: (MODPYTHON-181) Memory leak when using handlers in  
Graham Dumpleton (JIRA)


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


 
05-01-07 12:12 PM


[ https://issues.apache.org/jira/brow...ls:all-tabpanel ]

Graham Dumpleton closed MODPYTHON-181.
--------------------------------------


> Memory leak when using handlers in multiple phases at same time.
> ----------------------------------------------------------------
>
>                 Key: MODPYTHON-181
>                 URL: https://issues.apache.org/jira/browse/MODPYTHON-181
>             Project: mod_python
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.1.4, 3.3, 3.2.8
>            Reporter: Graham Dumpleton
>         Assigned To: Graham Dumpleton
>             Fix For: 3.3
>
>
> When using handlers against multiple phases, ie.,
> # .htaccess
> PythonFixupHandler handlers
> AddHandler mod_python .py
> PythonHandler handlers
> # handlers.py
> from mod_python import apache
> def handler(req):
>   req.content_type = 'text/plain'
>   req.write('handler')
>   return apache.OK
> def fixuphandler(req):
>   return apache.OK
> mod_python will leak memory on each request, which Apache child process si
zes blowing out quite quickly.
> The problem code is in python_handler() in 'src/mod_python.c'. Specificall
y the code does:
>     if (!hle) {
>         /* create a handler list object from dynamically registered handle
rs */
>         request_obj->hlo = (hlistobject *)MpHList_FromHLEntry(dynhle, 1);
>     }
>     else {
>         /* create a handler list object */
>         request_obj->hlo = (hlistobject *)MpHList_FromHLEntry(hle, 1);
>         /* add dynamically registered handlers, if any */
>         if (dynhle) {
>             MpHList_Append(request_obj->hlo, dynhle);
>         }
>     }
> Problem is that request_obj->hlo can already be set by a prior phase's han
dler and by simply assigning to request_obj->hlo you get a memory leak as it
 refers to an existing Python object and it isn't being decref'd.
> Thus, before this 'if' statement, it would appear that the following shoul
d
> be inserted.
>     if (request_obj->hlo)
>         Py_DECREF(request_obj->hlo);
> or:
>     Py_XDECREF(request_obj->hlo);






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 10:33 AM.      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