[asterisk-bugs] [JIRA] (ASTERISK-25645) res_rtp_asterisk: Lock inversion

Steve Davies (JIRA) noreply at issues.asterisk.org
Mon Jan 4 04:17:33 CST 2016


    [ https://issues.asterisk.org/jira/browse/ASTERISK-25645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=228795#comment-228795 ] 

Steve Davies commented on ASTERISK-25645:
-----------------------------------------

OK, I have checked this and can confirm that Dade was correct about my non-standard Asterisk-11 build.

Because I have linked asterisk 11 against pjproject-2.4.5, there is a different set of locking occurring in pjnath during the on_ice_complete callback.

In the asterisk-11 built-in version, the sequence is:
{noformat}
lock ice->mutex
unlock ice->mutex
call cb.on_ice_callback
{noformat}

In pjproject-2.4.5, the sequence is:
{noformat}
pj_group_lock ice->grp_lock
call cb.on_ice_callback
pj_group_unlock ice->grp_lock
{noformat}
(This same group lock is used in pj_ice_sess_send_data, hence the potential deadlock)

So I can 'fix' my asterisk 11 issue by reverting to the previous pjproject - I would warn that this locking sequence may still bite Asterisk-13, but I have not researched that version enough to know for sure, so YMMV.

> res_rtp_asterisk: Lock inversion
> --------------------------------
>
>                 Key: ASTERISK-25645
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-25645
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Resources/res_rtp_asterisk
>            Reporter: Steve Davies
>         Attachments: deadlocked_threads.txt, experimental_anti_deadlock
>
>
> Reported by Steve Davies on asterisk-dev:
> commit 5e6b1476a087407a052f007d326c504cfeefebe7
> ASTERISK-25614
> 2 code paths which approximate the following will cause a lock-inversion deadlock:
> approximate call orders are:
> a)
> pj_timer_heap_poll (PJ_LOCK)
> ast_rtp_on_ice_complete
> ast_rtp_instance_set_remote_address
> remote_address_set
> ast_rtp_remote_address_set
> (DTLS_LOCK)
> ...
> b)
> ast_pbx...
> app_dial
> bridge...
> read
> rtp_read
> ...
> __rtp_recvfrom
> (DTLS_LOCK)
> dtls_srtp_check_pending
> __rtp_sendto
> pj_ice_sess_send_data
> (PJ_LOCK)



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list