[asterisk-bugs] [Asterisk 0017375]: iax2-parser eating memory if not LOW_MEMORY set.

Asterisk Bug Tracker noreply at bugs.digium.com
Thu Jun 3 18:00:33 CDT 2010


The following issue has been RESOLVED. 
====================================================================== 
https://issues.asterisk.org/view.php?id=17375 
====================================================================== 
Reported By:                edantie
Assigned To:                russell
====================================================================== 
Project:                    Asterisk
Issue ID:                   17375
Category:                   Channels/chan_iax2
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     resolved
Asterisk Version:           SVN 
JIRA:                       SWP-1522 
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!): 265217 
Request Review:              
Resolution:                 no change required
Fixed in Version:           
====================================================================== 
Date Submitted:             2010-05-22 05:32 CDT
Last Modified:              2010-06-03 18:00 CDT
====================================================================== 
Summary:                    iax2-parser eating memory if not LOW_MEMORY set.
Description: 
I think there a problem in iax-parser.c: it's allocating more memory than
it release when LOW_MEMORY is not set... It applies at least to all 1.6 up
to trunk.

Try to explain:
I have added comments in iax_frame_free to see when it's adding a memory
space to pool.

like that at line 1192 of 1.6.2 svn:

        if (iax_frames->size < FRAME_CACHE_MAX_SIZE) {
+++                ast_verb(3, "Adding new frame to cache %d
(length:%d)\n",iax_frames->size, fr->afdatalen);

and one comment in iax_frame_new, line 1105
                        if (fr->afdatalen >= datalen) {
                                size_t afdatalen = fr->afdatalen;
                                AST_LIST_REMOVE_CURRENT(list);
                                iax_frames->size--;
                                memset(fr, 0, sizeof(*fr));
                                fr->afdatalen = afdatalen;
+++                                ast_verb(3,"Got frame from cache! new
size:%d\n",iax_frames->size);
                                break;


The extension is receiving an iax call and do another iax call
recompile and start doing a iax call.
What I've got is:


    -- Accepting AUTHENTICATED call from 172.16.222.1:
       > requested format = gsm,
       > requested prefs = (gsm|alaw),
       > actual format = alaw,
       > host prefs = (alaw|gsm),
       > priority = mine
    -- Executing [9006 at fromiax:1] MSet("IAX2/lpa-1993",
"__PHONENUMBER=9006") in new stack
    -- Executing [9006 at fromiax:2] Dial("IAX2/lpa-1993",
"IAX2/lpa:contactel at 172.16.222.1/61010") in new stack
    -- Called lpa:contactel at 172.16.222.1/61010
    -- Call accepted by 172.16.222.1 (format alaw)
    -- Format for call is alaw
    -- IAX2/172.16.222.1:4569-864 is proceeding passing it to
IAX2/lpa-1993
    -- Adding new frame to cache 0 (length:160)
    -- Adding new frame to cache 0 (length:160)
    -- Adding new frame to cache 0 (length:160)
    -- Adding new frame to cache 0 (length:160)
    -- Adding new frame to cache 0 (length:160)
    -- Got frame from cache! new size:0
    -- Adding new frame to cache 0 (length:160)
 
Will attach full extension log 

The problem is that it trying to add 5 frames to spool without using it...


I think there should be some locking in iax free to avoid the problem...
====================================================================== 

---------------------------------------------------------------------- 
 (0122930) russell (administrator) - 2010-06-03 18:00
 https://issues.asterisk.org/view.php?id=17375#c122930 
---------------------------------------------------------------------- 
Yep, it's a thread-local cache 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-06-03 18:00 russell        Note Added: 0122930                          
2010-06-03 18:00 russell        Status                   assigned => resolved
2010-06-03 18:00 russell        Resolution               reopened => no change
required
======================================================================




More information about the asterisk-bugs mailing list