[asterisk-bugs] [JIRA] (ASTERISK-28197) stasis: ast_endpoint struct holds the channel_ids of channels past destruction in certain cases

mohit dhiman (JIRA) noreply at issues.asterisk.org
Tue Dec 11 11:31:47 CST 2018


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

mohit dhiman commented on ASTERISK-28197:
-----------------------------------------

I did some debugging and found that {{endpoint_cache_clear}} is the route callback for an endpoint which is responsible for cleanup of channel_ids 

In case of {{Bridge}} application when {{bridge_exec}} from {{features.c}} is invoked it calls the {{ast_channel_unref(current_dest_chan)}} to remove the channel reference if channel is not in the Bridge, which gives the following function call stack.
{quote}
#0  topic_remove_subscription (topic=0x7fbf2c008290, sub=0x36095a0) at stasis.c:711
#1  0x00000000005c8a22 in stasis_forward_cancel (forward=0x7fbf2c009fa8) at stasis.c:925
#2  0x00000000004cd126 in ast_channel_internal_cleanup (chan=0x7fbf2c0243d0) at channel_internal_api.c:1553
#3  0x00000000004af818 in ast_channel_destructor (obj=0x7fbf2c0243d0) at channel.c:2363
#4  0x000000000045b94b in internal_ao2_ref (user_data=0x7fbf2c0243d0, delta=-1, file=0x61cb0b "astobj2.c", line=518, func=0x61cd21 <__FUNCTION__.8693> "__ao2_ref")
    at astobj2.c:451
#5  0x000000000045bc2e in __ao2_ref (user_data=0x7fbf2c0243d0, delta=-1) at astobj2.c:518
#6  0x000000000050c26a in bridge_exec (chan=0x7fbf2c00a4d0, data=0x7fbfb3ffc460 "SIP/201-00000000") at features.c:1129
{quote}

finally the call to {{stasis_forward_cancel}} causes the removal of 4 subscribers from the non-pbx channel's topic and one of those 4 subscribers carries the callback {{endpoint_cache_clear}} which is needed to remove channel_ids from {{struct ast_endpoint}} 

> stasis: ast_endpoint struct holds the channel_ids of channels past destruction in certain cases
> -----------------------------------------------------------------------------------------------
>
>                 Key: ASTERISK-28197
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-28197
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Core/Channels, Core/Stasis
>    Affects Versions: 13.21.0
>         Environment: Centos 7
>            Reporter: mohit dhiman
>              Labels: bridge-application, endpoints.c, memory-leak
>         Attachments: originate_bridge_channel_count_test.txt
>
>
> For every call i made through asterisk to an endpoint the {{ast_endpoint}} struct adds that channel to its channel_ids {{ao2_container}} and after the channel gets destroyed it should remove it from that channel_ids list but the {{channel_count}} for endpoint is continuously increasing for every call i make to that endpoint.
> i verified this by adding some warning logs to the {{ast_endpoint_snapshot_create}} function of {{main/endpoints.c}}, this log prints the channel_count for that endpoint.
> [Dec 5 17:14:45] WARNING[7397] endpoints.c: channel count: 107069 max channel: -1
> [Dec 5 17:14:45] WARNING[7397] endpoints.c: channel count: 107070 max channel: -1
> [Dec 5 17:14:45] WARNING[7397] endpoints.c: channel count: 107071 max channel: -1
> [Dec 5 17:14:45] WARNING[7397] endpoints.c: channel count: 107072 max channel: -1
> here channel count corresponds to
> {{channel_count = ao2_container_count(endpoint->channel_ids);}}
> also there are no more than 400 channels at any instance.



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



More information about the asterisk-bugs mailing list