[asterisk-bugs] [JIRA] (ASTERISK-25023) Deadlock in chan_sip in update_provisional_keepalive

Arnd Schmitter (JIRA) noreply at issues.asterisk.org
Mon May 4 02:59:32 CDT 2015


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

Arnd Schmitter commented on ASTERISK-25023:
-------------------------------------------

I will try, to get a better trace, but the machine on which the deadlock appeared is a productive system with quite a high load and it is running for days without any problem.

But in my opinion, the case is quite clear and as far as i can see there are two possible solutions.

# Release the sip_pvt lock before deleting old scheduled jobs in update_provisional_keepalive and reacquire the lock afterwards.
# Use a try_lock in send_provisional_keepalive_full and if it fails return with an appropriate error code that the job gets rescheduled again.  


> Deadlock in chan_sip in update_provisional_keepalive
> ----------------------------------------------------
>
>                 Key: ASTERISK-25023
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-25023
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Channels/chan_sip/General
>    Affects Versions: 13.3.2
>         Environment: centos 6 / 64Bit
>            Reporter: Arnd Schmitter
>         Attachments: trace.txt
>
>
> There is a race condition / deadlock when update_provisional_keepalive is called.
> If there is already a scheduler run plant for calling send_provisional_keepalive_full.
> the func update_provisional_keepalive gets called with a locked sip_pvt struct and the first thing it does is delete the plant scheduler.
> If the plant scheduler is started after the sip_pvt lock and before the AST_SCHED_DEL_UNREF call in update_provisional_keepalive is executed, the scheduler job is blocked in send_provisional_keepalive_full, waiting to get a lock on the sip_pvt struct.
> The call to AST_SCHED_DEL_UNREF is waiting for a condistion signal, that the running scheduler finish.



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



More information about the asterisk-bugs mailing list