[asterisk-bugs] [JIRA] (ASTERISK-24451) chan_iax2: reference leak in sched_delay_remove

Matt Jordan (JIRA) noreply at issues.asterisk.org
Tue Oct 28 11:48:29 CDT 2014


    [ https://issues.asterisk.org/jira/browse/ASTERISK-24451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=223168#comment-223168 ] 

Matt Jordan commented on ASTERISK-24451:
----------------------------------------

So the weird thing is that reference bump is balanced. The variable in question is {{peercnt}}:

{code}
3033:	if ((peercnt = ao2_find(peercnts, &tmp, OBJ_POINTER))) {
3034:		/* refcount is incremented with ao2_find.  keep that ref for the scheduler */
3035:		ast_debug(1, "schedule decrement of callno used for %s in %d seconds\n", ast_sockaddr_stringify_addr(addr), MIN_REUSE_TIME);
3036:		i = iax2_sched_add(sched, MIN_REUSE_TIME * 1000, peercnt_remove_cb, peercnt);
3037:		if (i == -1) {
3038:			ao2_ref(peercnt, -1);
3039:		}
3040:	}
{code}

The variable leaking is {{peercnt}}. The function that should drop the reference is {{peercnt_remove_cb}}, which should be called so long as {{iax2_sched_add}} returns anything but {{-1}}, in which case we drop the reference ourselves. {{iax2_sched_add}} calls {{ast_sched_add}} - which returns {{-1}} on failure and the scheduled ID if the scheduler succeeded.

So the question is - why is the callback function {{peercnt_remove_cb}} not getting called? Does a {{gdb backtrace}} of the running Asterisk instance show any weird locking situations?

The other option would be to put some debug into {{chan_iax2}} and try to find out why that callback isn't being run, or if the scheduler isn't firing for some reason.

> chan_iax2: reference leak in sched_delay_remove
> -----------------------------------------------
>
>                 Key: ASTERISK-24451
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-24451
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Channels/chan_iax2
>    Affects Versions: 13.0.0-beta3
>            Reporter: Corey Farrell
>            Severity: Minor
>         Attachments: refs.txt
>
>
> {{sched_delay_remove}} seems to leak references to {{peercnt}}.  This issue was found with the testsuite using ASTERISK-24379.  Many tests produce the leak.
> I don't know chan_iax2 but am reporting this in the hopes that someone can address it so we can get the full testsuite leak free.  I have not checked this issue against versions other than 13.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list