[svn-commits] file: trunk r402347 - in /trunk: ./ include/asterisk/ res/ari/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Nov 1 07:33:11 CDT 2013


Author: file
Date: Fri Nov  1 07:33:09 2013
New Revision: 402347

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=402347
Log:
res_ari_channels: Fix a deadlock when originating multiple channels close to eachother.

If a Stasis application is specified an implicit subscription is done on the originated
channel. This was previously done with the channel lock held which is dangerous as the
underlying code locks the container and iterates items. This change releases the lock
on the originated channel before subscribing occurs.

(closes issue ASTERISK-22768)
Reported by: Matt Jordan

Review: https://reviewboard.asterisk.org/r/2979/
........

Merged revisions 402346 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/include/asterisk/stasis_app.h
    trunk/res/ari/resource_channels.c

Propchange: trunk/
------------------------------------------------------------------------------
--- branch-12-merged (original)
+++ branch-12-merged Fri Nov  1 07:33:09 2013
@@ -1,1 +1,1 @@
-/branches/12:1-398558,398560-398577,398579-399305,399307-401390,401392-402276,402285,402289,402327,402336
+/branches/12:1-398558,398560-398577,398579-399305,399307-401390,401392-402276,402285,402289,402327,402336,402346

Modified: trunk/include/asterisk/stasis_app.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/stasis_app.h?view=diff&rev=402347&r1=402346&r2=402347
==============================================================================
--- trunk/include/asterisk/stasis_app.h (original)
+++ trunk/include/asterisk/stasis_app.h Fri Nov  1 07:33:09 2013
@@ -140,6 +140,8 @@
  *             after adding the subscription.
  *
  * \return \ref stasis_app_subscribe_res return code.
+ *
+ * \note Do not hold any channel locks if subscribing to a channel.
  */
 enum stasis_app_subscribe_res stasis_app_subscribe(const char *app_name,
 	const char **event_source_uris, int event_sources_count,

Modified: trunk/res/ari/resource_channels.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/ari/resource_channels.c?view=diff&rev=402347&r1=402346&r2=402347
==============================================================================
--- trunk/res/ari/resource_channels.c (original)
+++ trunk/res/ari/resource_channels.c Fri Nov  1 07:33:09 2013
@@ -642,6 +642,9 @@
 		return;
 	}
 
+	snapshot = ast_channel_snapshot_create(chan);
+	ast_channel_unlock(chan);
+
 	if (!ast_strlen_zero(args->app)) {
 		/* channel: + channel ID + null terminator */
 		char uri[9 + strlen(ast_channel_uniqueid(chan))];
@@ -651,10 +654,7 @@
 		stasis_app_subscribe(args->app, uris, 1, NULL);
 	}
 
-	snapshot = ast_channel_snapshot_create(chan);
 	ast_ari_response_ok(response, ast_channel_snapshot_to_json(snapshot));
-
-	ast_channel_unlock(chan);
 	ast_channel_unref(chan);
 }
 




More information about the svn-commits mailing list