[Home]

Summary:ASTERISK-17359: [patch] astobj2.c does not report ref changes during internal_ao2_callback for refcounter util
Reporter:Rob Gagnon (rgagnon)Labels:
Date Opened:2011-02-06 20:23:23.000-0600Date Closed:2011-02-09 15:08:24.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) branch-1.8-r306540-astobj-fix.diff
( 1) trunk-r306540-astobj-fix.diff
Description:While using the refcounter utility to find memory leaks in chan_sip.c, I recognized some ref counter increases and decreases were not being recorded in /tmp/refs

There is one call to __ao2_link() within internal_ao2_callback that is the cause of this tag not getting written to /tmp/refs

****** ADDITIONAL INFORMATION ******

If REF_DEBUG is defined, all ref increase and decrease calls need to be written to /tmp/refs, or else the refcounter utility will mistakenly report a problem where there is not, or may not report a problem where there really is one.  This can lead to memory leaks or crashes in asterisk code when the output of refcounter is used as a guide to finding leaks.

You can see this operation if you check the output of refcounter.  Some tags written for a problem will not show an increment or decrement in the tail end of the output.

IE:
you might see:
0xb67348 -1   chan_sip.c:24125:handle_request_do (throw away dialog ptr from find_call at end of routine) [@4]
0xb67348 -1   chan_sip.c:3772:__sip_ack (unref pkt cur->owner dialog from sip ack before freeing pkt) [@4]

instead of:
0xb67348 -1   chan_sip.c:24125:handle_request_do (throw away dialog ptr from find_call at end of routine) [@4]
0xb67348 +1   chan_sip.c:7498:find_call (pedantic ao2_find in dialogs) [@3]
0xb67348 -1   chan_sip.c:3772:__sip_ack (unref pkt cur->owner dialog from sip ack before freeing pkt) [@4]

NOTE in the first block how the increase at line 7498 of find_call was not shown--indicated by the two "[@4]" suffixes in a row.  That suffix must always change by one to be a valid report.

See attached patch files for both the trunk, and branch 1.8 repos

Comments:By: Digium Subversion (svnbot) 2011-02-09 15:06:35.000-0600

Repository: asterisk
Revision: 307273

U   branches/1.8/main/astobj2.c

------------------------------------------------------------------------
r307273 | jpeeler | 2011-02-09 15:06:34 -0600 (Wed, 09 Feb 2011) | 8 lines

Add missing debug info for ao2_link for use with REF_DEBUG in ao2 callback.

(closes issue ASTERISK-17359)
Reported by: rgagnon
Patches:
     branch-1.8-r306540-astobj-fix.diff uploaded by rgagnon (license 1202)
     trunk-r306540-astobj-fix.diff uploaded by rgagnon (license 1202)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=307273

By: Digium Subversion (svnbot) 2011-02-09 15:08:23.000-0600

Repository: asterisk
Revision: 307274

_U  trunk/
U   trunk/main/astobj2.c

------------------------------------------------------------------------
r307274 | jpeeler | 2011-02-09 15:08:23 -0600 (Wed, 09 Feb 2011) | 15 lines

Merged revisions 307273 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
 r307273 | jpeeler | 2011-02-09 15:06:33 -0600 (Wed, 09 Feb 2011) | 8 lines
 
 Add missing debug info for ao2_link for use with REF_DEBUG in ao2 callback.
 
 (closes issue ASTERISK-17359)
 Reported by: rgagnon
 Patches:
       branch-1.8-r306540-astobj-fix.diff uploaded by rgagnon (license 1202)
       trunk-r306540-astobj-fix.diff uploaded by rgagnon (license 1202)
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=307274