[asterisk-bugs] [Asterisk 0018403]: [patch] Deadlock on SIP blind transfer (REFER)

Asterisk Bug Tracker noreply at bugs.digium.com
Fri Jan 14 11:32:57 CST 2011


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=18403 
====================================================================== 
Reported By:                jthurman
Assigned To:                jpeeler
====================================================================== 
Project:                    Asterisk
Issue ID:                   18403
Category:                   Channels/chan_sip/Transfers
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     acknowledged
Target Version:             1.8.3
Asterisk Version:           SVN 
JIRA:                       SWP-2667 
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): 1.8 
SVN Revision (number only!): 296824 
Request Review:              
====================================================================== 
Date Submitted:             2010-11-30 18:25 CST
Last Modified:              2011-01-14 11:32 CST
====================================================================== 
Summary:                    [patch] Deadlock on SIP blind transfer (REFER)
Description: 
All SIP:
- A calls B
- B blind-transfers A to C (Using REFER)
- Asterisk stops responding to SIP requests (Deadlocked)

======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
related to          0018554 SIP channel tried to release unowned mu...
====================================================================== 

---------------------------------------------------------------------- 
 (0130505) svnbot (reporter) - 2011-01-14 11:32
 https://issues.asterisk.org/view.php?id=18403#c130505 
---------------------------------------------------------------------- 
Repository: asterisk
Revision: 301790

U   branches/1.8/channels/chan_sip.c

------------------------------------------------------------------------
r301790 | jpeeler | 2011-01-14 11:32:53 -0600 (Fri, 14 Jan 2011) | 42
lines

Resolve deadlock involving REFER.

Two fixes:
1) One must always have the private unlocked before calling
pbx_builtin_setvar_helper to not invalidate locking order since it locks
the
channel.
2) Unlock the channel before calling pbx_find_extension, which starts and
stops
autoservice during the lookup. The problem scenario as illustrated by the
reporter:

Thread: do_monitor
-----------------------
handle_request_do
 handle_incoming
  handle_request_refer
   ast_parking_ext_valid
    pbx_find_extension
     ast_autoservice_stop
      while (chan_list_state == as_chan_list_state) { usleep(1000); }

Thread: autoservice_run
-----------------------
autoservice_run
 chan = ast_waitfor_n
  ast_waitfor_nandfds
   ast_waitfor_nandfds_classic / simple / complex (depending on your
system)
    ast_channel_lock(c[x]);

handle_request_do and schedule_process_request_queue locks the owner
if it exists. The autoservice thread is waiting for the channel lock,
which
wasn't ever released since the do_monitor thread was waiting for
autoservice
operations to complete. Solved by unlocking the channel but keeping a
reference
to guarantee safety.

(closes issue https://issues.asterisk.org/view.php?id=18403)
Reported by: jthurman
Patches: 
      20110103-blind_deadlock.diff uploaded by jthurman (license 614)
      issue18403.patch uploaded by jpeeler (license 325)
Tested by: jthurman


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

http://svn.digium.com/view/asterisk?view=rev&revision=301790 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-01-14 11:32 svnbot         Checkin                                      
2011-01-14 11:32 svnbot         Note Added: 0130505                          
======================================================================




More information about the asterisk-bugs mailing list