[asterisk-dev] [Code Review] Deadlock ao2_callback / ast_write / handle_incoming

irroot reviewboard at asterisk.org
Wed Apr 13 06:06:20 CDT 2011


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1171/
-----------------------------------------------------------

(Updated 2011-04-13 06:06:20.431789)


Review request for Asterisk Developers.


Changes
-------

Ok this makes more sense and may fix #19107 as well 

if i cant get the private lock and im here i hold the channel lock so there is a deadlock somewhere let me 
release and re lock the channel before i try again to allow the thread holding the private to release it ...
 


Summary
-------


Channel walk is contending a lock on a channel held by ast_write while sip_write is contending a private lock held by handle incoming that is contending the channel lock held by the write ...

now if i was holding the channel lock in handle_incoming before i locked private this would not happen ... 

some how ive been appointed the deadlock fairy ... monitoring +/- 100 1.8 sites for deadlocks and attempt to fix them as they
popup.


=== Thread ID: 0xb3cf7b70 (do_devstate_changes started at [ 724] devicestate.c ast_device_state_engine_init())
=== ---> Lock #0 (astobj2.c): MUTEX 657 internal_ao2_callback c 0x85fe1b8 (1)
=== ---> Waiting for Lock #1 (channel.c): MUTEX 1641 ast_channel_cmp_cb chan 0xabb7a558 (1)
=== --- ---> Locked Here: channel.c line 4690 (ast_write)
=== -------------------------------------------------------------------
===
=== Thread ID: 0xabf3fb70 (do_monitor started at [24621] chan_sip.c restart_monitor())
=== ---> Lock #0 (chan_sip.c): MUTEX 24593 do_monitor &monlock 0xb314fde0 (1)
=== ---> Lock #1 (chan_sip.c): MUTEX 23781 handle_incoming p 0xab7c94a8 (1)
=== ---> Waiting for Lock #2 (channel.c): MUTEX 1361 __ast_queue_frame chan 0xabb7a558 (1)
=== --- ---> Locked Here: channel.c line 4690 (ast_write)
=== -------------------------------------------------------------------
===
=== Thread ID: 0xab6c3b70 (pbx_thread started at [ 5038] pbx.c ast_pbx_start())
=== ---> Lock #0 (channel.c): MUTEX 4690 ast_write chan 0xabb7a558 (1)
=== ---> Waiting for Lock #1 (chan_sip.c): MUTEX 6083 sip_write p 0xab7c94a8 (1)
=== --- ---> Locked Here: chan_sip.c line 23781 (handle_incoming)
=== -------------------------------------------------------------------
=== 


This addresses bugs 19107 and 19112.
    https://issues.asterisk.org/view.php?id=19107
    https://issues.asterisk.org/view.php?id=19112


Diffs (updated)
-----

  /branches/1.8/channels/chan_sip.c 313425 

Diff: https://reviewboard.asterisk.org/r/1171/diff


Testing
-------


Thanks,

irroot

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20110413/62e65734/attachment.htm>


More information about the asterisk-dev mailing list