Fix multiple issues with musiconhold, which led to classes not getting destroyed properly.

* Classes are now tracked past removal from the core container, and module
   removal is actively prevented until all references are freed.
 * A hanging reference stored in the channel has been removed.  This could have
   caused a mismatch and the music state not properly cleared, if two or more
   reloads occurred between MOH being stopped and MOH being restarted.
 * In certain circumstances, duplicate classes were possible.
 * A race existed at reload time between a process being killed and the thread
   responsible for reading from the related pipe respawning that process.
 * Several reference counts have also been corrected.  At least one could have
   caused deleted classes to stick around forever, consuming resources.  This
   originally manifested as MOH external processes that were not killed at
   reload time.
(closes issue #16279, closes issue #16207)
 Reported by: parisioa, dcabot
 Patches: 
       20091202__issue16279__2.diff.txt uploaded by tilghman (license 14)
 Tested by: parisioa, tilghman


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@232660 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Tilghman Lesher
2009-12-03 00:08:55 +00:00
parent 2081809b07
commit 7e0a2db236
2 changed files with 190 additions and 43 deletions

View File

@@ -207,7 +207,7 @@ were called to appear in /tmp/refs, you can do this sort of thing:
#ifdef REF_DEBUG
#define dialog_ref(arg1,arg2) dialog_ref_debug((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__)
#define dialog_unref(arg1,arg2) dialog_unref_debug((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__)
static struct sip_pvt *dialog_ref_debug(struct sip_pvt *p, char *tag, char *file, int line, const char *func)
static struct sip_pvt *dialog_ref_debug(struct sip_pvt *p, char *tag, const char *file, int line, const char *func)
{
if (p)
ao2_ref_debug(p, 1, tag, file, line, func);
@@ -216,7 +216,7 @@ static struct sip_pvt *dialog_ref_debug(struct sip_pvt *p, char *tag, char *file
return p;
}
static struct sip_pvt *dialog_unref_debug(struct sip_pvt *p, char *tag, char *file, int line, const char *func)
static struct sip_pvt *dialog_unref_debug(struct sip_pvt *p, char *tag, const char *file, int line, const char *func)
{
if (p)
ao2_ref_debug(p, -1, tag, file, line, func);