[asterisk-bugs] [JIRA] (ASTERISK-27861) [patch] res_pjsip_endpoint_identifier_ip: Unregister the module for headers.
Friendly Automation (JIRA)
noreply at issues.asterisk.org
Fri May 18 16:43:56 CDT 2018
[ https://issues.asterisk.org/jira/browse/ASTERISK-27861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=243458#comment-243458 ]
Friendly Automation commented on ASTERISK-27861:
------------------------------------------------
Change 9005 merged by Kevin Harwell:
res_pjsip_endpoint_identifier_ip: Unregister the module for headers.
[https://gerrit.asterisk.org/9005|https://gerrit.asterisk.org/9005]
> [patch] res_pjsip_endpoint_identifier_ip: Unregister the module for headers.
> ----------------------------------------------------------------------------
>
> Key: ASTERISK-27861
> URL: https://issues.asterisk.org/jira/browse/ASTERISK-27861
> Project: Asterisk
> Issue Type: Bug
> Security Level: None
> Components: Resources/res_pjsip_endpoint_identifier_ip
> Affects Versions: 13.21.0, 15.4.0
> Reporter: Alexander Traud
> Assignee: Alexander Traud
> Labels: patch, pjsip
> Attachments: pjsip_unload_1.patch
>
>
> This issue was caused by [Commit 8494e78|https://github.com/asterisk/asterisk/commit/8494e78010d8917a4165d877045be34ddc2dda22] (ASTERISK-27491). A new sub-module was introduced, it is registered with res_pjsip and therefore increases the reference count on the needed res_pjsip module. res_pjsip should not go, before it is released. So far so good.
> However, this new module does not unregister itself on unload. Therefore, res_pjsip leaks a reference. The attached patch fixes this.
> *Steps to Reproduce*
> # an UNIX operating system, for example Ubuntu 18.04 LTS
> # sudo apt install build-essential pkg-config libedit-dev libjansson-dev libsqlite3-dev uuid-dev libxslt1-dev
> # wget downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz
> # tar -zxf ./asterisk\-*-current.tar.gz
> # cd ./asterisk\-*
> # ./configure --with-pjproject-bundled
> # make menuselect.makeopts
> # ./menuselect/menuselect --enable REF_DEBUG
> # make
> # sudo make install config basic-pbx
> # sudo stop service asterisk
> # asterisk -cd
> # core stop gracefully
> *Expected Result*
> Asterisk cleanly ending (0).
> *Actual Results*
> loader.c:652 modules_shutdown: Passing on res_pjsip.so: its use count is 1
> loader.c:652 modules_shutdown: Passing on res_pjproject.so: its use count is 1
> loader.c:652 modules_shutdown: Passing on res_sorcery_config.so: its use count is 12
> loader.c:652 modules_shutdown: Passing on res_sorcery_memory.so: its use count is 2
> loader.c:652 modules_shutdown: Passing on res_sorcery_astdb.so: its use count is 2
> Some modules could not be unloaded, switching to fast shutdown
> *Approach*
> When a module leaks, one approach is to look at Menuselect and the dependencies. Every module which is required for another module, is not likely the cause of the leak. For example, the modules res_pjproject and res_sorcery_* are required to run the module res_pjsip. Therefore, the not-null reference count of res_pjsip.c is the likely candidate. Then, I went for the [Reference Counts Log| https://wiki.asterisk.org/wiki/display/AST/Reference+Count+Debugging#ReferenceCountDebugging-EnablingReferenceCountLogs] and looked at res_pjsip.c. Each unbalanced (un)register/(un)load is a candidate for a leak. In this case here, an ast_sip_unregister_endpoint_identifier(.) was missing.
> *Note*
> This is the third reference count leak I report. With the exception of Asterisk 13.18.0 till Asterisk 13.19.1, {{core stop gracefully}} was broken since Asterisk 13.13 (Nov. 2016). All these could have been found via the command-line interface (CLI). End-users of Asterisk might not be aware that this is a bug or think this bug is not relevant because its symptoms are so obvious. Furthermore, analyzing such bugs afterwards is terrible time consuming because I do not know the area which was worked on. Therefore, I recommend to add a test case so {{core stop gracefully}} works for each release.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
More information about the asterisk-bugs
mailing list