[asterisk-bugs] [JIRA] (ASTERISK-22252) res_musiconhold cleanup - REF_DEBUG reload warnings and ref leaks

Asterisk Team (JIRA) noreply at issues.asterisk.org
Wed Jul 27 10:30:20 CDT 2016


     [ https://issues.asterisk.org/jira/browse/ASTERISK-22252?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Asterisk Team updated ASTERISK-22252:
-------------------------------------

    Target Release Version/s: 14.0.0

> res_musiconhold cleanup - REF_DEBUG reload warnings and ref leaks
> -----------------------------------------------------------------
>
>                 Key: ASTERISK-22252
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-22252
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Resources/res_musiconhold
>    Affects Versions: 1.8.23.0
>            Reporter: Walter Doekes
>            Assignee: Jonathan Rose
>      Target Release: 1.8.24.0, 11.13.0, 12.6.0, 13.0.0-beta2, 14.0.0
>
>         Attachments: 18_moh_debug_ref_patch.diff
>
>
> Actually tested on trunk and 10. But the problem is the same:
> Add REF_DEBUG on top of {{res/res_musiconhold.c}} and we get this, alternating:
> {noformat}
> *CLI> moh reload
> [2013-08-05 11:34:03] WARNING[31076]: res_musiconhold.c:257 _mohclass_unref: Attempt to unref mohclass 0x7f50902826a8 (default) when only 1 ref remained, and class is still in a container! (at res_musiconhold.c:1324 (_moh_register))
> *CLI> moh reload
> (nothing)
> {noformat}
> I don't see what that custom REF_DEBUG code is doing there. Removing the custom {{_mohclass_unref}} makes the warning go away. refcounter(1) is now happy.
> For the record, the offending code:
> {noformat}
> #define mohclass_unref(class,string) _mohclass_unref(class, string, __FILE__,__LINE__,__PRETTY_FUNCTION__)
> static struct mohclass *_mohclass_unref(struct mohclass *class, const char *tag, const char *file, int line, const char *funcname)
> {
>         struct mohclass *dup;
>         if ((dup = ao2_find(mohclasses, class, OBJ_POINTER))) {
>                 if (__ao2_ref_debug(dup, -1, (char *) tag, (char *) file, line, funcname) == 2) {
>                         FILE *ref = fopen("/tmp/refs", "a");
>                         if (ref) {
>                                 fprintf(ref, "%p =1   %s:%d:%s (%s) BAD ATTEMPT!\n", class, file, line, funcname, tag);
>                                 fclose(ref);
>                         }
>                         ast_log(LOG_WARNING, "Attempt to unref mohclass %p (%s) when only 1 ref remained, and class is still in a container! (at %s:%d (%s))\n",
>                                 class, class->name, file, line, funcname);
>                 } else {
>                         ao2_ref(class, -1);
>                 }
>         } else {
>                 ao2_t_ref(class, -1, (char *) tag);
>         }
>         return NULL;
> }
> {noformat}



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



More information about the asterisk-bugs mailing list