[svn-commits] mmichelson: branch 1.6.1 r138888 - in /branches/1.6.1: ./ apps/app_chanspy.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Aug 19 13:53:22 CDT 2008


Author: mmichelson
Date: Tue Aug 19 13:53:22 2008
New Revision: 138888

URL: http://svn.digium.com/view/asterisk?view=rev&rev=138888
Log:
Merged revisions 138887 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r138887 | mmichelson | 2008-08-19 13:52:04 -0500 (Tue, 19 Aug 2008) | 31 lines

Merged revisions 138886 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r138886 | mmichelson | 2008-08-19 13:50:53 -0500 (Tue, 19 Aug 2008) | 23 lines

Add a lock and unlock prior to the destruction of the chanspy_ds
lock to ensure that no other threads still have it locked. While
this should not happen under normal circumstances, it appears that
if the spyer and spyee hang up at nearly the same time, the following
may occur.

1. ast_channel_free is called on the spyee's channel.
2. The chanspy datastore is removed from the spyee's channel in 
   ast_channel_free.
3. In the spyer's thread, the spyer attempts to remove and destroy the datastore
   from the spyee channel, but the datastore has already been removed in step 2, 
   so the spyer continues in the code.
4. The spyee's thread continues and calls the datastore's destroy callback, 
   chanspy_ds_destroy. This involves locking the chanspy_ds.
5. Now the spyer attempts to destroy the chanspy_ds lock. The problem is that in step 4, 
   the spyee has locked this lock, meaning that the spyer is attempting to destroy a lock 
   which is currently locked by another thread.

The backtrace provided in issue #12969 supports the idea that this is possible
(and has even occurred). This commit does not close the issue, but should help
in preventing one type of crash associated with the use of app_chanspy.


........

................

Modified:
    branches/1.6.1/   (props changed)
    branches/1.6.1/apps/app_chanspy.c

Propchange: branches/1.6.1/
------------------------------------------------------------------------------
--- trunk-merged (original)
+++ trunk-merged Tue Aug 19 13:53:22 2008
@@ -1,1 +1,1 @@
-/trunk:1-137647,137680,137732,137780,137812,137848,137933,137987,138024,138028,138086,138124,138148,138155,138207,138260,138311,138361,138409,138412,138442,138473,138476,138479,138482,138518,138631,138687,138694,138775,138778-138780,138815,138845
+/trunk:1-137647,137680,137732,137780,137812,137848,137933,137987,138024,138028,138086,138124,138148,138155,138207,138260,138311,138361,138409,138412,138442,138473,138476,138479,138482,138518,138631,138687,138694,138775,138778-138780,138815,138845,138887

Modified: branches/1.6.1/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/apps/app_chanspy.c?view=diff&rev=138888&r1=138887&r2=138888
==============================================================================
--- branches/1.6.1/apps/app_chanspy.c (original)
+++ branches/1.6.1/apps/app_chanspy.c Tue Aug 19 13:53:22 2008
@@ -893,6 +893,8 @@
 
 	ast_channel_setoption(chan, AST_OPTION_TXGAIN, &zero_volume, sizeof(zero_volume), 0);
 
+	ast_mutex_lock(&chanspy_ds.lock);
+	ast_mutex_unlock(&chanspy_ds.lock);
 	ast_mutex_destroy(&chanspy_ds.lock);
 
 	return res;




More information about the svn-commits mailing list