[asterisk-bugs] [Asterisk 0018310]: [patch] hint state changes deadlock/race

Asterisk Bug Tracker noreply at bugs.digium.com
Tue Jan 18 14:13:56 CST 2011


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=18310 
====================================================================== 
Reported By:                one47
Assigned To:                jpeeler
====================================================================== 
Project:                    Asterisk
Issue ID:                   18310
Category:                   Core/PBX
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     ready for testing
Target Version:             1.6.2.17
Asterisk Version:           1.6.2.14 
JIRA:                       SWP-2541 
Regression:                 No 
Reviewboard Link:           https://reviewboard.asterisk.org/r/1072 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2010-11-15 12:19 CST
Last Modified:              2011-01-18 14:13 CST
====================================================================== 
Summary:                    [patch] hint state changes deadlock/race
Description: 
VERY similar to https://issues.asterisk.org/view.php?id=18165, but this is a
different deadlock path, so I have
raised a separate report.

Thread 1: taskprocessor  -> handle_statechange
    Lock order = conlock, hints, hint, pvt
Thread 2: chan_sip.c:  handle_request_do -> handle_response_notify
    Lock order = pvt, conlock

Thread2 only gets into the conlock if STATECHANGEQUEUE is true, ie. there
are rapid state changes happening on a subscribed hint.
======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
related to          0018165 [patch] hint state changes deadlock pro...
has duplicate       0018535 app_queue deadlocks if weight is set
====================================================================== 

---------------------------------------------------------------------- 
 (0130636) svnbot (reporter) - 2011-01-18 14:13
 https://issues.asterisk.org/view.php?id=18310#c130636 
---------------------------------------------------------------------- 
Repository: asterisk
Revision: 302265

U   branches/1.6.2/main/pbx.c

------------------------------------------------------------------------
r302265 | jpeeler | 2011-01-18 14:13:53 -0600 (Tue, 18 Jan 2011) | 27
lines

Convert device state callbacks to ao2 objects to fix a deadlock in
chan_sip.

Lock scenario presented here:
Thread 1
 holds ast_rdlock_contexts &conlock
 holds handle_statechange hints
 holds handle_statechange hint
  waiting for cb_extensionstate
   Locked Here: chan_sip.c line 7428 (find_call)
Thread 2
 holds handle_request_do &netlock
 holds find_call sip_pvt_ptr
  waiting for ast_rdlock_contexts &conlock
   Locked Here: pbx.c line 9911 (ast_rdlock_contexts)

Chan_sip has an established locking order of locking the sip_pvt and then
getting the context lock. So the as stated by the summary, the operations
in
thread 2 have been modified to no longer require the context lock.

(closes issue https://issues.asterisk.org/view.php?id=18310)
Reported by: one47
Patches: 
      statecbs_ao2.mk2.patch uploaded by one47 (license 23),
      modified by me

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

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

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

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-01-18 14:13 svnbot         Checkin                                      
2011-01-18 14:13 svnbot         Note Added: 0130636                          
======================================================================




More information about the asterisk-bugs mailing list