[asterisk-commits] russell: branch 1.6.1 r201613 - in /branches/1.6.1: ./ res/res_musiconhold.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 18 10:36:30 CDT 2009


Author: russell
Date: Thu Jun 18 10:36:11 2009
New Revision: 201613

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=201613
Log:
Merged revisions 201610 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
  r201610 | russell | 2009-06-18 10:27:10 -0500 (Thu, 18 Jun 2009) | 36 lines
  
  Merged revisions 201600 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r201600 | russell | 2009-06-18 10:24:31 -0500 (Thu, 18 Jun 2009) | 29 lines
    
    Fix memory corruption and leakage related reloads of non files mode MoH classes.
    
    For Music on Hold classes that are not files mode, meaning that we are executing
    an application that will feed us audio data, we use a thread to monitor the
    external application and read audio from it.  This thread also makes use of the
    MoH class object.  In the MoH class destructor, we used pthread_cancel() to ask
    the thread to exit.  Unfortunately, the code did not wait to ensure that the
    thread actually went away.  What needed to be done is a pthread_join() to ensure
    that the thread fully cleans up before we proceed.  By adding this one line, we
    resolve two significant problems:
    
      1) Since the thread was never joined, it never fully goes away.  So, on every
         reload of non-files mode MoH, an unused thread was sticking around.
    
      2) There was a race condition here where the application monitoring thread
         could still try to access the MoH class, even though the thread executing
         the MoH reload has already destroyed it.
    
    (issue #15109)
    Reported by: jvandal
    
    (issue #15123)
    Reported by: axisinternet
    
    (issue #15195)
    Reported by: amorsen
    
    (issue AST-208)
  ........
................

Modified:
    branches/1.6.1/   (props changed)
    branches/1.6.1/res/res_musiconhold.c

Propchange: branches/1.6.1/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.1/res/res_musiconhold.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.1/res/res_musiconhold.c?view=diff&rev=201613&r1=201612&r2=201613
==============================================================================
--- branches/1.6.1/res/res_musiconhold.c (original)
+++ branches/1.6.1/res/res_musiconhold.c Thu Jun 18 10:36:11 2009
@@ -1385,9 +1385,10 @@
 	while ((member = AST_LIST_REMOVE_HEAD(&class->members, list))) {
 		free(member);
 	}
-	
+
 	if (class->thread) {
 		pthread_cancel(class->thread);
+		pthread_join(class->thread, NULL);
 		class->thread = AST_PTHREADT_NULL;
 	}
 




More information about the asterisk-commits mailing list