[asterisk-dev] need help debugging a deadlock in

Antonio Goméz Soto antonio.gomez.soto at gmail.com
Wed Oct 6 15:33:29 CDT 2010

Op 05-10-10 22:31, Russell Bryant schreef:
> ----- Original Message -----
>> Hello,
>> I am new to this list. I have a deadlock in, that I am trying
>> to debug myself.
>> What happens is there are two threads that lock resources in a
>> different order causing a deadlock.
>> The threads are:
>> 1. from taskprocessor handle_statechange() is called.
>> This one locks ast_rdlock_contexts, and then eventually call
>> cb_extensionstate()
>> which immediately does a sip_pvt_lock()
>> 2. do_monitor calls sipsock_read() which calls handle_request_do()
>> which calls
>> find_call(), which does a sip_pvt_lock() too.
>> The incoming request is a subscription, so it calls ast_get_hint(),
>> which calls
>> ast_hint_extension() which calls ast_rdlock_contexts(). Deadlock.
>>  From what I know, I'd say the last thread uses the wrong order. It
>> would probably
>> not be appropriate to lock the contexts for each incoming request
>> would it?
>> Can anyone suggest how to handle this?
> I have a patch that I started working on last week for Asterisk 1.4 that would address this deadlock.  It will eventually have to be ported to all versions of Asterisk.
> The change that I made was to change the operation of thread #1.  I modified the storage of hints to use astobj2.  The code path in #1 no longer holds the hints lock and contexts lock while processing each configured hint.


is there an open issue for this?


> --
> Russell Bryant
> Digium, Inc.  |  Engineering Manager, Open Source Software
> 445 Jan Davis Drive NW   -    Huntsville, AL 35806  -  USA
> jabber: rbryant at digium.com    -=-    skype: russell-bryant
> www.digium.com -=- www.asterisk.org -=- blogs.asterisk.org

More information about the asterisk-dev mailing list