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

Walter Doekes (JIRA) noreply at issues.asterisk.org
Mon Aug 5 04:43:03 CDT 2013


Walter Doekes created ASTERISK-22252:
----------------------------------------

             Summary: musiconhold with 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
    Affects Versions: 1.8.23.0
            Reporter: Walter Doekes


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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.asterisk.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the asterisk-bugs mailing list