Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#1646 closed defect (fixed)

Deadlock and crash problem in transaction related to transport

Reported by: bennylp Owned by: bennylp
Priority: normal Milestone: release-2.2
Component: pjsip Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported: no

Description

Two problems are covered by this ticket:

1. Deadlock in transport disconnection notification

TCP and TLS transport disconnection will notify transaction by calling tsx_tp_state_callback(). Unfortunately this causes deadlock with at least two scenarios below:

  1. Deadlock between transport mutex and transaction group lock:
    • thread 1: tsx sending a message. It is holding transaction group lock and acquiring transport mutex.
    • thread 2: disconnection event from transport. Thread is holding transport mutex and acquiring transaction group lock
  1. Deadlock between transaction group lock and dialog mutex
    • thread 1: dialog sending message. It is holding dialog mutex and acquiring transaction group lock.
    • thread 2: a network operation on different transaction caused disconnection event to be triggered and transport is notifying transaction. Thread is holding transaction mutex and is acquiring dialog lock to notify dialog.

2. Crash because transaction is destroyed prematurely while sending is in progress

When network is congested, sending operation will be queued and later a completion callback in the transaction will be called. If transaction is destroyed (for example due to transport disconnection or transaction timeout) while the sending operation is in progress, a crash will occur later when the pending send operation completes.

Change History (4)

comment:1 Changed 11 years ago by bennylp

In 4444:

Part 1 of re #1646: fixed the deadlock problem in SIP transaction related to transport event

comment:2 Changed 11 years ago by bennylp

  • Resolution set to fixed
  • Status changed from new to closed

In 4446:

Part 2, fixed #1646: crash in transaction when it is destroyed while transport operation is in progress

comment:3 Changed 11 years ago by bennylp

In 4448:

More on re #1646: added flag to prevent another transmit data from being transmitted while we are waiting for the previous one to be flushed from transport queue

comment:4 Changed 11 years ago by nanang

  • Component changed from applications to pjsip
  • Milestone set to release-2.2
Note: See TracTickets for help on using tickets.