Skip to content
Snippets Groups Projects
  • Richard Mudgett's avatar
    237d341b
    res_pjsip.c: Split ast_sip_push_task_synchronous() to fit expectations. · 237d341b
    Richard Mudgett authored
    ast_sip_push_task_synchronous() did not necessarily execute the passed in
    task under the specified serializer.  If the current thread is any
    registered pjsip thread then it would execute the task immediately instead
    of under the specified serializer.  Reentrancy issues could result if the
    task does not execute with the right serializer.
    
    The original reason ast_sip_push_task_synchronous() checked to see if the
    current thread was a registered pjsip thread was because of a deadlock
    with masquerades and the channel technology's fixup callback
    (ASTERISK_22936).  A subsequent masquerade deadlock fix (ASTERISK_24356)
    involving call pickups avoided the original deadlock situation entirely.
    The PJSIP channel technology's fixup callback no longer needed to call
    ast_sip_push_task_synchronous().
    
    However, there are a few places where this unexpected behavior is still
    required to avoid deadlocks.  The pjsip monitor thread executes callbacks
    that do calls to ast_sip_push_task_synchronous() that would deadlock if
    the task were actually pushed to the specified serializer.  I ran into one
    dealing with the pubsub subscriptions where an ao2 destructor called
    ast_sip_push_task_synchronous().
    
    * Split ast_sip_push_task_synchronous() into
    ast_sip_push_task_wait_servant() and ast_sip_push_task_wait_serializer().
    ast_sip_push_task_wait_servant() has the old behavior of
    ast_sip_push_task_synchronous().  ast_sip_push_task_wait_serializer() has
    the new behavior where the task is always executed by the specified
    serializer or a picked serializer if one is not passed in.  Both functions
    behave the same if the current thread is not a SIP servant.
    
    * Redirected ast_sip_push_task_synchronous() to
    ast_sip_push_task_wait_servant() to preserve API for released branches.
    
    ASTERISK_26806
    
    Change-Id: Id040fa42c0e5972f4c8deef380921461d213b9f3
    237d341b
    History
    res_pjsip.c: Split ast_sip_push_task_synchronous() to fit expectations.
    Richard Mudgett authored
    ast_sip_push_task_synchronous() did not necessarily execute the passed in
    task under the specified serializer.  If the current thread is any
    registered pjsip thread then it would execute the task immediately instead
    of under the specified serializer.  Reentrancy issues could result if the
    task does not execute with the right serializer.
    
    The original reason ast_sip_push_task_synchronous() checked to see if the
    current thread was a registered pjsip thread was because of a deadlock
    with masquerades and the channel technology's fixup callback
    (ASTERISK_22936).  A subsequent masquerade deadlock fix (ASTERISK_24356)
    involving call pickups avoided the original deadlock situation entirely.
    The PJSIP channel technology's fixup callback no longer needed to call
    ast_sip_push_task_synchronous().
    
    However, there are a few places where this unexpected behavior is still
    required to avoid deadlocks.  The pjsip monitor thread executes callbacks
    that do calls to ast_sip_push_task_synchronous() that would deadlock if
    the task were actually pushed to the specified serializer.  I ran into one
    dealing with the pubsub subscriptions where an ao2 destructor called
    ast_sip_push_task_synchronous().
    
    * Split ast_sip_push_task_synchronous() into
    ast_sip_push_task_wait_servant() and ast_sip_push_task_wait_serializer().
    ast_sip_push_task_wait_servant() has the old behavior of
    ast_sip_push_task_synchronous().  ast_sip_push_task_wait_serializer() has
    the new behavior where the task is always executed by the specified
    serializer or a picked serializer if one is not passed in.  Both functions
    behave the same if the current thread is not a SIP servant.
    
    * Redirected ast_sip_push_task_synchronous() to
    ast_sip_push_task_wait_servant() to preserve API for released branches.
    
    ASTERISK_26806
    
    Change-Id: Id040fa42c0e5972f4c8deef380921461d213b9f3