[Home]

Summary:ASTERISK-10454: deadlock between ast_softhangup and zt_bridge (using mixmonitor on bridged channels)
Reporter:Peter Holik (peterh)Labels:
Date Opened:2007-10-05 05:44:04Date Closed:2007-10-05 11:28:53
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Channels/chan_zap
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:mixmonitor claims channel->lock (c1) and makes ast_softhangup for
the bridged peer(c0) but chan_zap holds the lock for c0 -> deadlock


--- chan_zap.c.orig     2007-08-14 11:09:09.000000000 +0200
+++ chan_zap.c  2007-10-04 16:31:01.000000000 +0200
@@ -3338,7 +3338,10 @@
               /* Here's our main loop...  Start by locking things, looking for private parts,
                  and then balking if anything is wrong */
               ast_mutex_lock(&c0->lock);
-               ast_mutex_lock(&c1->lock);
+               if (ast_mutex_trylock(&c1->lock)) {
+                   ast_mutex_unlock(&c0->lock);
+                   continue;
+               }
               p0 = c0->tech_pvt;
               p1 = c1->tech_pvt;

****** ADDITIONAL INFORMATION ******

This occourse also on asterisk 1.2



PLEASE TAKE THIS PATCH AS IT IS - YOU WONT GET A DISCLAIMER FROM ME
Comments:By: Digium Subversion (svnbot) 2007-10-05 11:23:57

Repository: asterisk
Revision: 84783

U   branches/1.4/channels/chan_zap.c

------------------------------------------------------------------------
r84783 | russell | 2007-10-05 11:23:56 -0500 (Fri, 05 Oct 2007) | 4 lines

Do deadlock avoidance in a couple more places.  You can't lock two channels
at the same time without doing extra work to make sure it succeeds.
(closes issue ASTERISK-10454, patch by me)

------------------------------------------------------------------------

By: Digium Subversion (svnbot) 2007-10-05 11:28:53

Repository: asterisk
Revision: 84784

_U  trunk/
U   trunk/channels/chan_zap.c

------------------------------------------------------------------------
r84784 | russell | 2007-10-05 11:28:52 -0500 (Fri, 05 Oct 2007) | 12 lines

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

........
r84783 | russell | 2007-10-05 11:44:21 -0500 (Fri, 05 Oct 2007) | 4 lines

Do deadlock avoidance in a couple more places.  You can't lock two channels
at the same time without doing extra work to make sure it succeeds.
(closes issue ASTERISK-10454, patch by me)

........

------------------------------------------------------------------------